Linux Redhat 4.4.7 安裝 8.0.13 MySQL Community Server

1.剛開始安裝mysql參考這個:mysql

    https://blog.csdn.net/a116475939/article/details/74625377sql

2.修改密碼tcp

mysql> use mysql;
     #先把密碼置爲空字符串;(不讓後面修改密碼會報錯)
mysql> update user set authentication_string="" where user="root";
     #這個刷新很是有必要;不讓後面執行alter就會出錯
mysql> flush privileges;
mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '密碼';

3.建立用戶以及賦權ide

mysql> create user 'shenbo'@'%' identified by '$mima...';
Query OK, 0 rows affected (0.21 sec)
mysql> grant all privileges on *.* to 'shenbo'@'%' ;
Query OK, 0 rows affected (0.06 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

 4.設置防火牆 vi /etc/sysconfig/iptablesthis

# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT而後執行 service iptables restart
相關文章
相關標籤/搜索