CentOS7.5下安裝、配置MySql5.6數據庫 --CentOS7.5

1、下載MySql的rpm包

[root@VM_39_157_centos ~]# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

 

[root@VM_39_157_centos ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm

2、更新yum

[root@VM_39_157_centos ~]# yum update

3、使用yum安裝mysql-server

[root@VM_39_157_centos ~]# yum install mysql-server

3、賦權限

[root@VM_39_157_centos ~]# chown mysql:mysql -R /var/lib/mysql

4、初始化

[root@VM_39_157_centos ~]# mysqld --initialize 

5、啓動服務:

[root@VM_39_157_centos ~]# systemctl start mysqld

6、查看服務狀態:

[root@VM_39_157_centos ~]# systemctl status mysqld

7、設置開機啓動

[root@VM_39_157_centos ~]# systemctl enable mysqld

8、設置密碼

[root@VM_39_157_centos ~]# mysqladmin -uroot password '123'

9、設置免密登錄

mysql 配置文件目錄:/etc/my.cnf

root 密碼爲空的時候配置文件中下面這句:

skip-grant-tables

10、設置root用戶可訪問,後期連接上之後可以重新設置

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密碼' WITH GRANT OPTION;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章