当前位置:   article > 正文

群晖7.2 安装了mariadb,如何开启外网访问权限

群晖7.2 安装了mariadb,如何开启外网访问权限

群晖7.2 安装了mariadb,如何开启外网访问权限遇到的问题,及解决办法记录。

前言

群晖7.2 安装了mariadb,想要开启外网访问权限,网站找了很多教程,都比较老了,有的已经不适用了,
这里将遇到**ERROR 1356 (HY000)**报错的解决做一下记录:
MariaDB [mysql]> update user set host=‘%’ where user=‘root’;
ERROR 1356 (HY000): View ‘mysql.user’ references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

操作过程及报错

下面是网上教程的大致操作过程(会报错)

  1. 首先,确保您的群晖NAS(Network Attached Storage,网络附加存储)已经安装了MariaDB数据库。您可以从套件中心(Package Center)中搜索并安装MariaDB套件。
  2. 安装完成后,打开SSH功能。在套件中心中搜索“shell”并安装“Shell & File Access”套件。然后,在Shell & File Access设置中启用SSH功能,并设置好SSH端口号。
  3. 使用SSH客户端(如PuTTY)连接到群晖NAS的IP地址和设置的SSH端口号。输入群晖的登录用户名和密码,登录到群晖的命令行界面。
  4. 进入MariaDB的安装目录。默认情况下,MariaDB安装在“/volume1/@appstore/MariaDB10/usr/local/mariadb10/bin”目录下。您可以使用以下命令进入该目录:
cd /volume1/@appstore/MariaDB10/usr/local/mariadb10/bin
  • 1
  1. 登录到MariaDB数据库。使用以下命令以root用户身份登录:
./mysql -u root -p
  • 1
  1. 在MariaDB提示符下,执行以下命令来更新root用户的访问权限:
use mysql;
update user set host='%' where user='root';
  • 1
  • 2

到这里报错
MariaDB [mysql]> update user set host=‘%’ where user=‘root’;
ERROR 1356 (HY000): View ‘mysql.user’ references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

正确操作按以下步骤进行操作:

  1. 首先,确保您的群晖NAS(Network Attached Storage,网络附加存储)已经安装了MariaDB数据库。您可以从套件中心(Package Center)中搜索并安装MariaDB套件。
  2. 安装完成后,打开SSH功能。在套件中心中搜索“shell”并安装“Shell & File Access”套件。然后,在Shell & File Access设置中启用SSH功能,并设置好SSH端口号。
  3. 使用SSH客户端(如PuTTY)连接到群晖NAS的IP地址和设置的SSH端口号。输入群晖的登录用户名和密码,登录到群晖的命令行界面。
  4. 进入MariaDB的安装目录。默认情况下,MariaDB安装在“/volume1/@appstore/MariaDB10/usr/local/mariadb10/bin”目录下。您可以使用以下命令进入该目录

用ssh连接nas后

sudo -i
# 输入群晖管理员密码
# 进入目录
cd /volume1/@appstore/MariaDB10/usr/local/mariadb10/bin

  • 1
  • 2
  • 3
  • 4
  • 5

登录到MariaDB数据库。使用以下命令以root用户身份登录:

./mysql -u root -p
# 输入mariadb root 用户密码

# 'your passwd' 换成你自己的 mariadb  root密码
grant all privileges on *.* to 'root'@'%' identified by 'your passwd';
delete from mysql.user where User='';
FLUSH PRIVILEGES;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

完整过程如下:

# 输入mariadb root 用户密码
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 131
Server version: 10.11.2-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)]> grant all privileges on *.* to 'root'@'%' identified by 'your mariadb's password';
Query OK, 0 rows affected (0.005 sec)

MariaDB [(none)]> delete from mysql.user where User='';
Query OK, 2 rows affected (0.006 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.001 sec)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小舞很执着/article/detail/786671
推荐阅读
相关标签
  

闽ICP备14008679号