群晖 mysql 远程_群晖 MariaDB10 开启远程登录

群晖安装 MariaDB10 后,默认仅支持本机连接,也就是说,你的局域网电脑是连接不上的,如果需要局域网连接,需要做处理。

环境:群晖6.2、MariaDB10

处理方法:

1、使用 ssh 登录到群晖

2、进入 MariaDB 默认安装目录

cd /volume1/@appstore/MariaDB10/usr/local/mariadb10/bin

3、使用 root 登录 MariaDB,然后进行修改

admin@XiaoMageNAS:~$ sudo -i

root@XiaoMageNAS:~# cd /volume1/@appstore

root@XiaoMageNAS:/volume1/@appstore# ls

AudioStation DownloadStation MailPlus-Server NoteStation PHP7.0 TextEditor WebStation

CloudStation ffmpeg MariaDB10 PDFViewer PHP7.2 transmission

CloudSync Git Node.js_v12 Perl PythonModule VideoStation

Docker MailClient Node.js_v8 PhotoStation SynologyApplicationService WebDAVServer

root@XiaoMageNAS:/volume1/@appstore# cd /volume1/@appstore/MariaDB10/usr/local/mariadb10/bin

root@XiaoMageNAS:/volume1/@appstore/MariaDB10/usr/local/mariadb10/bin#

root@XiaoMageNAS:/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 14

Server version: 10.3.21-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.001 sec)

MariaDB [mysql]>

其中 host 为 % 表示不限制IP,你也可以设置具体的IP地址,或者网段 192.168.1.% 这样。

另外,上面出现的 ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY' 不予理会,其意思是 host 为主键,不能设置重复的值。所以我们后来的查询中,host 还是3个不同的值。刚刚执行的 update 语句只成功修改了数据库中一条数据。

4、不需要重启服务,即可连接登录。

本文由 小马哥 创作,采用 知识共享署名4.0 国际许可协议进行许可

本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名

最后编辑时间为:

2020/06/13 22:29

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值