标签:
CentOS 7不带Mysql数据库了,默认的数据库是MariaDB(Mysql的一个分支)。
可以按照以下步骤手动安装Mysql数据库。
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. 可以看出,server和client都被选择安装。选择y,自动下载安装。
4. 安装完成后,启动Mysql。
systemctl start mysqld.service
5. 设置root密码。
update user set password=password("123456") where user=‘root‘;
6. 开机自启动。
1 vim /etc/rc.local 2 添加service mysqld start
标签:
原文地址:http://www.cnblogs.com/yoyotl/p/5752437.html