一、centos7安装MySQL
CentOS 7的yum源中貌似没有正常安装mysql时的mysql-sever文件,需要去官网上下载
成功安装之后重启mysql服务
初次安装mysql是root账户是没有密码的
设置密码的方法
1. Disable Firewalld Service.
[root@rhel-centos7-tejas-barot-linux ~]# systemctl mask firewalld
2. Stop Firewalld Service.
[root@rhel-centos7-tejas-barot-linux ~]# systemctl stop firewalld
3. Install iptables service related packages.
[root@rhel-centos7-tejas-barot-linux ~]# yum -y install iptables-services
4. Make sure service starts at boot:
[root@rhel-centos7-tejas-barot-linux ~]# systemctl enable iptables
# If you do not want ip6tables, You can skip following command.
[root@rhel-centos7-tejas-barot-linux ~]# systemctl enable ip6tables
5. Now, Finally Let’s start the iptables services.
[root@rhel-centos7-tejas-barot-linux ~]# systemctl start iptables
# If you do not want ip6tables, You can skip following command.
[root@rhel-centos7-tejas-barot-linux ~]# systemctl start ip6tables
三、允许远程登录
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'IDENTIFIED BY '123456' WITH GRANT OPTION;
FLUSH PRIVILEGES ;
参考资料: http://www.centoscn.com/mysql/2014/0930/3881.html
参考资料:http://www.centoscn.com/CentOS/2015/0313/4877.html