安装mysql步骤:
1.[下载mysql](wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.15-1.el7.x86_64.rpm-bundle.tar)
tar -xvf mysql-8.0.15-1.el7.x86_64.rpm-bundle.tar
rpm -ivh mysql-community-common-8.0.15-1.el7.x86_64.rpm
- 安装libaio.so 依赖
wget http://mirror.centos.org/centos/6/os/x86_64/Packages/libaio-0.3.107-10.el6.x86_64.rpm
- 查询冲突依赖
rpm -qa | grep mariadb
- 强制移除冲突依赖
rpm -e --nodeps mariadb-libs
rpm -ivh mysql-community-libs-8.0.15-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.15-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.15-1.el7.x86_64.rpm
- 启动mysql
service mysqld start
- 查看mysql 是否启动
ps -ef|grep mysql
- 查看mysql默认密码
cat /var/log/mysqld.log
- 进入mysql 命令行
mysql -u
+账号+-p
+密码 账号默认root 密码使用默认密码 - 执行 下面代码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '1234567aA<';//修改密码
use mysql;
update user set host = '%' where user = 'root';//允许任意主机远程连接
FLUSH PRIVILEGES;//刷新权限列表
quit //退出mysql命令行
15.设置自启动 systemctl enable mysqld.service