2021-03-30 群晖Mariadb远程登陆

win+x 打开 Win10 自带的power shell

群晖,控制面板,高级模式,最后一个“终端机和SNMP”,在终端机里面选择启动SSH功能,默认端口22

C:\Users\> ssh 用户名@NAS地址 -p 22

(如果提示不认识ssh,搜索一下网上文章如何添加Windows组件)

输入密码后

提示符从win的提示符变成$号结束的提示符

用户名@nas:~$
用户名@nas:~$ cd /volume1/@appstore/MariaDB10/usr/local/mariadb10/bin
用户名@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 25
Server version: 10.3.24-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)]>

提示符变成mariadb的了,none表示没有选择数据库

MariaDB [(none)]> use mysql
Database changed
MariaDB [mysql]> update user set host='192.168.0.%' where user ='root';
ERROR 1062 (23000): Duplicate entry '192.168.0.%-root' for key 'PRIMARY'  
MariaDB [mysql]> select host,user from user;
+-------------+------+
| host        | user |
+-------------+------+
| 192.168.0.% | 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.066 sec)
MariaDB [mysql]>

搞了这么多命令行
其实群晖里面用phpMyAdmin也可以轻松改
登陆phpMyAdmin,账户,新建,在登录信息中
用户名:root
主机名:192.168.0.%
密码:

填完执行就OK了

你可能感兴趣的:(2021-03-30 群晖Mariadb远程登陆)