1.移除 MySQL 伺服器
先停止MySQL運作。
service mysqld stop
移除所有MySQL相關套件
yum remove mysql* mysql-server mysql-devel mysql-libs -y
2.準備安裝 MariaDB
新增MariaDB repo
vi /etc/yum.repos.d/mariadb.repo
32位元系統
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3.7/centos7-x86/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
64位元系統
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3.7/centos7-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
baseurl = http://... 可自行尋找要安裝的版本更改路徑
3.更新CentOS
yum update -y
4.開始安裝 MariaDB
yum install MariaDB-devel MariaDB-client MariaDB-server -y
啟動Mariadb
service mysql start
設定開機啟動MariaDB。
chkconfig mysql on
5.初始化 MariaDB
/usr/bin/mysql_secure_installation
Enter current password for root (enter for none):
default none press enter
Change the root password? [Y/n]
Y:set password
Remove anonymous users? [Y/n]
Y
Disallow root login remotely? [Y/n]
if want root login remotely press n
Remove test database and access to it? [Y/n]
Y
Reload privilege tables now? [Y/n]
Y:reload
6.設定root權限
mysql -u root -p
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
%:全開; 192.168.0.%允許192.168.0.0~225
FLUSH PRIVILEGES; (使權限表生效)
沒有留言:
張貼留言