在CentOS7系统上安装MySQL数据库

1.下载安装MySQL官方repo文件

下载MySQL的官方repo文件

[root@centos7 ~]# wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

安装MySQL的官方repo文件

[root@centos7 ~]# yum -y install mysql57-community-release-el7-10.noarch.rpm

2.安装MySQL数据库

[root@centos7 ~]# yum -y install mysql-community-server

3.配置MySQL数据库

启动数据库并查看数据库启动状态。

[root@centos7 ~]# systemctl start mysqld

[root@centos7 ~]# systemctl status mysqld

clip_image002

查看数据库安装的初始密码:

[root@centos7 ~]# grep "password" /var/log/mysqld.log

clip_image004

[root@centos7 ~]# mysql_secure_installation

Enter password for user root:---------------------------------------->使用查询到的密码

New password:--------------------------------------------------------->输入新密码

Re-enter new password:--------------------------------------------->重复密码

Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y

其他参数根据实际情况选择。

posted @ 2018-10-03 21:22  幻梦空间  阅读(241)  评论(0)    收藏  举报