An error occurred when modifying the MariaDB database user's Host today:
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
My steps are as follows:
1. Log in
2.use mysql;
3.执行:update user set host=‘%’ where user=‘root’;
Because the user table of MariaDB is a view, the executed statements are different from Mysql. You only need to execute the following statements:
rename user ‘root’@‘localhost’ to ‘root’@‘%’;
In addition, the operations for creating users and empowering users are attached:
Create user: create user 'username'@'%' identified by 'password';
Modify user password: alter user 'username'@'%' identified by 'password';
Delete a user: drop mysql.user 'username'@'%';
Authorized users: grant all on . to 'username'@'%' identified by 'password' with grant option;
After modifying the permissions, set Mariadb to allow remote connections
1. Modify the Mariadb configuration file
Add # to bind-address = 127.0.0.1 in /etc/mysql/mariadb.conf.d/50-server.cnf and comment out
2. Restart the service
systemctl restart mariadb.service
3. Remote link
mysql -u root -proot -h 192.168.199.240 -D mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.1.34-MariaDB-0ubuntu0.18.04.1 Ubuntu 18.04
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 [mysql]>