2.点击下载后,在下载页面选择操作系统
3.点击下载rpm文件,拿到这个下载链接
4.移除mariadb数据库
yum remove mariadb-libs.x86_64
5.进入到/tmp目录使用wget下载
wget https://repo.mysql.com//mysql80-community-release-el7-2.noarch.rpm
6.安装mysql的源
yum localinstall mysql80-community-release-el7-2.noarch.rpm
7.通过查找命令找到社区版的安装文件
yum search mysql
8.安装mysql
yum install mysql-community-server.x86_64
9.开启mysql服务
systemctl start mysqld
10.查看myqsl的默认密码
cat /var/log/mysqld.log
2019-03-27T03:05:34.627566Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.15) initializing of server in progress as process 29114
2019-03-27T03:05:38.631106Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: I+w=67d;+ES8
2019-03-27T03:05:40.427422Z 0 [System] [MY-013170] [Server] /usr/sbin/mysqld (mysqld 8.0.15) initializing of server has completed
2019-03-27T03:05:42.371036Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.15) starting as process 29161
2019-03-27T03:05:43.074650Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-03-27T03:05:43.117341Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.15' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server - GPL.
2019-03-27T03:05:43.166968Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060
11.使用密码进行登陆mysql
mysql -uroot -p
12.修改设置密码的验证规则
set global validate_password.policy=0;
set global validate_password.length=1;
13.修改root的密码
alter user 'root'@'localhost' identified by '新密码';
14.退出后,使用新密码登陆。查看数据库。
mysql -u root -p
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)