- 卸載mysql 或 mariadb
[root@elk-node2 ~]#rpm -qa|grep -i mysql
[root@elk-node2 ~]#rpm -qa|grep mariadb
[root@elk-node2 ~]#yum remove mariadb*
[root@MYSQL local]# cat /etc/my.cnf
cat: /etc/my.cnf: 沒有那個文件或目錄
[root@MYSQL local]# rm /etc/my.cnf
rm: 無法刪除"/etc/my.cnf": 沒有那個文件或目錄
- 配置網(wǎng)絡
[root@MYSQL local]# ifconfig
[root@MYSQL local]# cat /etc/sysconfig/network-scripts/ifcfg-ens33
##重啟網(wǎng)絡
[root@elk-node2 ~]#service network restart
[root@MYSQL local]# hostname
-----------------------------------------------------------------------------
MYSQL8.COM
-----------------------------------------------------------------------------
[root@MYSQL local]#vim /etc/sysconfig/network
-----------------------------------------------------------------------------
NETWORKING=yes
HOSTNAME=MYSQL8
-----------------------------------------------------------------------------
[root@MYSQL local]# # vim /etc/hosts
-----------------------------------------------------------------------------
192.168.40.8 MYSQL8
-----------------------------------------------------------------------------
[root@ZKA ~]# cat /etc/hostname
MYSQL8.COM
#數(shù)據(jù)庫服務器的的 selinux 都要 disable(永久關(guān)閉 selinux挑格,請修改/etc/selinux/config,將 SELINUX 改為 disabled)
[root@MYSQL local]# vim /etc/selinux/config
-----------------------------------------------------------------------------
SELINUX=disabled
-----------------------------------------------------------------------------
3.改防火墻設置盾鳞,打開 3306 端口:
[root@MYSQL local]# vim /etc/sysconfig/iptables
增加如下行:
-----------------------------------------------------------------------------
## MySQL
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
-----------------------------------------------------------------------------
重啟防火墻:
[root@MYSQL local]# service iptables restart
4.配置Mysql 8.0安裝源:
sudo rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
安裝Mysql 8.0
sudo yum --enablerepo=mysql80-community install mysql-community-server
啟動Mysql服務
sudo service mysqld start
查看Mysql服務狀態(tài)
service mysqld status
5.查看root用戶臨時密碼
grep "A temporary password" /var/log/mysqld.log
gu<p35Dxd&#l
6.配置Mysql安全策略
mysql_secure_installation
root/xag@163.COM
mysql -uroot -pxag@163.COM
mysql> set global validate_password_policy=0;
mysql> set global validate_password_length=1;
set global validate_password_mixed_case_count=2;
mysql> set global validate_password.policy=0;
set global validate_password.length=1;
CREATE USER 'system'@'%' IDENTIFIED BY '123456';
GRANT ALL ON *.* TO 'system'@'%';
(ALL表示授予所有權(quán)限瞳秽、*.*表示所有數(shù)據(jù)庫中的所有表胯杭、%表示任意IP可以遠程連接)
其他權(quán)限:ALTER船响、ALTER ROUTINE哈肖、CREATE吻育、CREATE ROUTINE、CREATE TABLESPACE淤井、CREATE TEMPORARY TABLES布疼、CREATE USER、CREATE VIEW币狠、DELETE游两、DROP、EVENT漩绵、EXECUTE贱案、FILE、GRANT OPTION止吐、INDEX宝踪、INSERT侨糟、LOCK TABLES、PROCESS瘩燥、PROXY秕重、REFERENCES、RELOAD厉膀、REPLICATION CLIENT溶耘、REPLICATION SLAVE、SELECT站蝠、SHOW DATABASES汰具、SHOW VIEW、SHUTDOWN菱魔、SUPER留荔、TRIGGER、UPDATE澜倦、USAGE聚蝶。
例如GRANT INSERT,SELECT,UPDATE ON *.* TO '[用戶名]'@'%';
Mysql 8.0的新特性,舊版本Navicat不支持藻治。
解決方案兩種:
①以舊版的方式重新設置遠程用戶的密碼碘勉。
ALTER USER 'system'@'%' IDENTIFIED WITH mysql_native_password BY '123456';