CentOS 7不带Mysql数据库了,默认的数据库是MariaDB(Mysql的一个分支)。
安装mysql的话会和mariadb的文件冲突,所以需要先卸载掉mariadb
具体步骤:
1.卸载mariadb
rpm -qa|grep mariadb
rpm -e –nodeps mariadb-libs-5.5.37-1.el7_0.x86_64
2.下载rpm安装文件
wget http://repo.mysql.com/mysql-community-release-el7.rpm
3.执行rpm安装
rpm -ivh mysql-community-release-el7.rpm
4.yum install mysql-server
5.安装完成后,启动Mysql。
systemctl start mysqld.service
初始无密码
6.设置root密码。
update user set password=password(“123456”) where user=’root’;
7.设置远程访问
grant all privileges on . to ‘root’@’%’ identified by ‘root’ with grant option;
flush privileges;
8.开机自启动(非必须)。
systemctl enable mysqld.service