CentOS 7不带Mysql数据库了,默认的数据库是MariaDB(Mysql的一个分支)。
可以按照以下步骤手动安装Mysql数据库。
0. 看起来mysql又提供yum安装了。
yum install mysql-server
后面的没时间可以不看了。
1. 下载rpm安装文件
wget http://repo.mysql.com/mysql-community-release-el7.rpm
2. 执行rpm安装
rpm -ivh mysql-community-release-el7.rpm
依赖解析完成后,出现下列选项:
1 Dependencies Resolved
2
3 ================================================================================================================================================================
4 Package Arch Version Repository Size
5 ================================================================================================================================================================
6 Installing:
7 mysql-community-libs x86_64 5.6.32-2.el7 mysql56-community 2.0 M
8 replacing mariadb-libs.x86_64 1:5.5.47-1.el7_2
9 mysql-community-server x86_64 5.6.32-2.el7 mysql56-community 59 M
10 Installing for dependencies:
11 mysql-community-client x86_64 5.6.32-2.el7 mysql56-community 19 M
12 mysql-community-common x86_64 5.6.32-2.el7 mysql56-community 256 k
13 perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7 base 32 k
14 perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 base 57 k
15 perl-DBI x86_64 1.627-4.el7 base 802 k
16 perl-IO-Compress noarch 2.061-2.el7 base 260 k
17 perl-Net-Daemon noarch 0.48-5.el7 base 51 k
18 perl-PlRPC noarch 0.2020-14.el7 base 36 k
19
20 Transaction Summary
21 ================================================================================================================================================================
22 Install 2 Packages (+8 Dependent packages)
23
24 Total download size: 82 M
25 Is this ok [y/d/N]:
3.yum install mysql-server即可。
可以看出,server和client都被选择安装。选择y,自动下载安装。
4. 安装完成后,启动Mysql。
systemctl start mysqld.service
查看默认密码
[root@localhost 01]# cat /var/log/mysqld.log | grep password 2019-05-23T08:15:53.202062Z 1 [Note] A temporary password is generated for root@localhost: k=wh6S7-)3VH ##这个就是密码
5. 设置root密码。
登录进去后修改密码:https://www.cnblogs.com/Crazy-Liu/p/10912599.html
6. 开机自启动。
systemctl enable mysqld ##centos7