打开https://dev.mysql.com/downloads/mysql/这个官网
[root@jiaxin-ceshi src]# wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.23-linux-glibc2.12-x86_64.tar.gz
cd /usr/local/
1,下载mysql5.7
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz
2,tar xf 解压并改名
3,创建用户和组
groupadd mysql
useradd mysql -s /sbin/nolgoin -g mysql
4,创建目录和赋予权限
mkdir /usr/local/mysql/data
chown -R /usr/local/mysql/data
5,初始化
yum install -y libaio
bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/
6,启动
/usr/local/mysql/support-files/mysql.server start
Qdyu/BQug5Pm
解决办法其实很简单:
将 /etc/mysql 下的 my.cnf 文件删除,再次启动MySQL服务
7.mysql -uroot -p
设置密码 set password=password('Szyq1234');
flush privileges;
update mysql.user set host="%" where user="root";
flush privileges;