mysql 5.7 安装
创建用户
groupadd mysql
useradd mysql -r -g mysql
初始化
bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql57 --datadir=/usr/local/mysql57/data
如果安装报错
bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
执行 yum install libaio 一下
启动
/usr/local/mysql57/bin/mysqld --defaults-file=/etc/my57.cnf --user=root
登录
mysql -uroot -p -S /tmp/mysql57.sock
修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
设置PATH环境变量。
# echo "export PATH=$PATH:/usr/local/mysql57/bin" > /etc/profile.d/mysql.sh
# source /etc/profile.d/mysql.sh