https://blog.csdn.net/catoop/article/details/86694473
群暉安裝 MariaDB10 后,默認僅支持本機連接,也就是說,你的局域網電腦是連接不上的,如果需要局域網連接,需要做處理。
環境:群暉6.2、MariaDB10
處理方法:
1、使用 ssh 登錄到群暉
2、進入 MariaDB 默認安裝目錄
cd /volume1/@appstore/MariaDB10/usr/local/mariadb10/bin
1
3、使用 root 登錄 MariaDB,然后進行修改
root@HOME-NAS:/volume1/@appstore/MariaDB10/usr/local/mariadb10/bin# ./mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 20
Server version: 10.3.7-MariaDB Source distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> use mysql
Database changed
MariaDB [mysql]> update user set host = '%' where user = 'root';
ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'
MariaDB [mysql]> select host,user from user;
+-----------+------+
| host | user |
+-----------+------+
| % | root |
| 127.0.0.1 | root |
| ::1 | root |
+-----------+------+
3 rows in set (0.000 sec)
MariaDB [mysql]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.053 sec)
MariaDB [mysql]>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
其中 host 為 % 表示不限制IP,你也可以設置具體的IP地址,或者網段 192.168.1.% 這樣。
另外,上面出現的 ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY' 不予理會,其意思是 host 為主鍵,不能設置重復的值。所以我們后來的查詢中,host 還是3個不同的值。剛剛執行的 update 語句只成功修改了數據庫中一條數據。
4、不需要重啟服務,即可連接登錄。
(END)
---------------------
作者:catoop
來源:CSDN
原文:https://blog.csdn.net/catoop/article/details/86694473
版權聲明:本文為博主原創文章,轉載請附上博文鏈接!