CentOS 7不帶Mysql數據庫了,默認的數據庫是MariaDB(Mysql的一個分支)。
安裝mysql的話會和mariadb的文件衝突,所以需要先卸載掉mariadb
具體步驟:
卸載mariadb
rpm -qa|grep mariadb
rpm -e –nodeps mariadb-libs-5.5.37-1.el7_0.x86_64下載rpm安裝文件
wget http://repo.mysql.com/mysql-community-release-el7.rpm執行rpm安裝
rpm -ivh mysql-community-release-el7.rpmyum install mysql-server
安裝完成後,啓動Mysql。
systemctl start mysqld.service
初始無密碼設置root密碼。
update user set password=password(“123456”) where user=’root’;設置遠程訪問
grant all privileges on . to ‘root’@’%’ identified by ‘root’ with grant option;
flush privileges;開機自啓動(非必須)。
systemctl enable mysqld.service