mkdir /usr/mysql 上传安装包mysql-5.7.25-1.el7.x86_64.rpm-bundle.tar 到工作目录 执行解压命令: tar -xvf mysql-5.7.25-1.el7.x86_64.rpm-bundle.tar
yum remove mysql-libs 清除依赖
- rpm -ivh mysql-community-common-5.7.25-1.el7.x86_64.rpm - rpm -ivh mysql-community-libs-5.7.25-1.el7.x86_64.rpm - rpm -ivh mysql-community-libs-compat-5.7.25-1.el7.x86_64.rpm - rpm -ivh mysql-community-client-5.7.25-1.el7.x86_64.rpm - rpm -ivh mysql-community-server-5.7.25-1.el7.x86_64.rpm
/usr/sbin/mysqld --initialize-insecure --user=root
/usr/sbin/mysqld --user=root &
mysql -uroot
alter user 'root'@'localhost' identified by 'root';
mysql -uroot -proot
mysql> use mysql; # 切换成mysql数据库 mysql> select user,host from user; # 查询用户信息
mysql> update user set host='%' where host='localhost';
mysql> flush privileges;
create database test;