# 如果出现以下错误: 2018-07-14 06:40:32 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize 2018-07-14 06:40:32 [ERROR] Child process: /usr/local/mysql/bin/mysqldterminated prematurely with errno= 32 2018-07-14 06:40:32 [ERROR] Failed to execute /usr/local/mysql/bin/mysqld --bootstrap --datadir=/usr/local/mysql/data --lc-messages-dir=/usr/local/mysql/share --lc-messages=en_US --basedir=/usr/local/mysql -- server log begin --
-- server log end -- # 则使用以下命令: /usr/local/mysql/bin/mysqld --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data --initialize
# 如果出现以下错误: /usr/local/mysql/bin/mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory # 则执行以下命令: yum -y install numactl
cp -a ./support-files/mysql.server /etc/init.d/mysql
若mysqld,以下mysql相应的修改mysqld,如下图所示
1 2
chmod +x /etc/init.d/mysql chkconfig --add mysql
检查服务是否生效
1
chkconfig --list mysql
启动
1 2
chown -R mysql.mysql /home/mysql service mysql start;
启动失败的解决办法
修改/etc/my.cnf
修改为自己设定的目录而不是默认目录
查看启动状态
1 2 3
service mysql status; ln -s /usr/local/mysql8.0/bin/mysql /usr/bin
登陆并修改密码
1
mysql -u root -p
如果出现以下错误
可以将套接字连接过去
1
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
修改密码及设置远程登陆
1 2 3 4 5 6 7 8
mysql -u root -p 输入初始化生成的零时密码
CREATE USER 'root'@'%' IDENTIFIED BY '密码'; ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '密码'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; flush privileges; quit;