最近由于有一批mysql数据需要使用,平常使用的测试数据库所在的硬盘只剩60G了,不够用,所以找了一台存储比较给力的机器冲重搭建了一个mysql,当然这里没啥技术点,这里只是纯粹记录一下,方便之后遇到类似的问题便于查找。
参考了一篇写的不错的博客,具体在这里。
这里我只把关键的点列出来,假设我想安装的目录为:/disk1/username/mysql_work/
cmake -DCMAKE_INSTALL_PREFIX=/disk1/username/mysql_work/local/mysql -DMYSQL_DATADIR=/disk1/username/mysql_work/local/mysql/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_UNIX_ADDR=/disk1/username/mysql_work/tmp/mysqld.sock -DWITH_INNOBASE_STORAGE_ENGINE=1
/disk1/username/mysql_work/local/mysql/scripts/mysql_install_db --user=work --basedir=/disk1/username/mysql_work/local/mysql --datadir=/disk1/username/mysql_work/local/mysql/data --no-defaults
/disk1/username/mysql_work/local/mysql/scripts/mysql_install_db --defaults-file=/disk1/username/mysql_work/local/mysql/my.cnf --datadir=/disk1/username/mysql_work/local/mysql/data/ --basedir=/disk1/username/mysql_work/local/mysql/
touch /disk1/username/mysql_work/tmp/mysqld.sock
/disk1/username/mysql_work/local/mysql/bin/mysqld_safe --defaults-file=/disk1/username/mysql_work/local/mysql/my.cnf & [注意这里要指定my.cnf否则会使用默认的/etc/my.cnf]
/disk1/username/mysql_work/local/mysql/bin/mysqladmin -u root password 'complexpss123'
create user 'root'@'%' identified by 'complexpss123';
create user 'root'@'***.**.com' identified by 'complexpss123';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'complexpss123';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'***.**.com' IDENTIFIED BY 'complexpss123';
FLUSH PRIVILEGES;
网友评论