CenterOS 使用rpm安装 mysql流程

一、进入服务器,使用weget下载

cd /usr/local/src

wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-server-5.7.27-1.el7.x86_64.rpm
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-client-5.7.27-1.el7.x86_64.rpm
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-libs-5.7.27-1.el7.x86_64.rpm
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-common-5.7.27-1.el7.x86_64.rpm

yum remove mariadb-libs
yum install net-tools
yum install *.rpm

二、修改/etc/my.cnf,跳过密码验证
vi /etc/my.cnf
在最后添加 : skip-grant-tables
保存退出

三、启动mysql服务,登录mysql修改密码
systemctl start mysqld.service
mysql -u root
flush privileges;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '密码';

结束。

常用命令:
systemctl start mysqld.service
systemctl status mysqld.service
systemctl stop mysqld.service
mysql -u root -p '密码'

参考:
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot exe

你可能感兴趣的:(CenterOS 使用rpm安装 mysql流程)