CentOS-7 安装mysql

# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

# rpm -ivh mysql-community-release-el7-5.noarch.rpm

# yum install mysql-community-server

成功安装之后重启mysql服务

# service mysqld restart

初次安装mysql是root账户是没有密码的

设置密码的方法

# mysql -uroot

mysql> set password for ‘root’@‘localhost’ = password('mypasswd');

mysql> exit

关闭防火墙

[root@localhost Desktop]# systemctl stop firewalld.service

[root@localhost Desktop]# systemctl status firewalld.service

[root@localhost Desktop]# systemctl disable firewalld.service

查询配置

vim /etc/my.cnf

show databases;

use mysql;

select * from user;