Brief: create a new mariadb (mysql) remote connection user. 1. use root for remote connection. By default, root does not allow remote database connection. MariaDB [mysql] & gt; selecthostfromuserwhereuser = & #39; root & #39; + --------------------- + | host
Brief: create a new mariadb (mysql) remote connection user.
1. use root for remote connection.
By default, root does not allow remote database connection.
MariaDB [mysql]> select host from user where user='root';+-----------------------+| host |+-----------------------+| 127.0.0.1 || ::1 || localhost || localhost.localdomain |
Modify the root user host in the user table to '%' and allow remote connection by the root user.
mysql>update user set host = '%' where user = 'root';
Pay attention to mysql security.
$ mysql_secure_installationDisallow root login remotely? [Y/n]
2. create a user, modify permissions, and remotely connect to the user.
Create user 'username' @ 'host' identified by 'password'; grant permission 1, permission 2 ,... Permission n on database name. table name to user name @ user address identified by 'connection password ';
Directly use grant to create the corresponding permission user.
MariaDB [(none)]> grant all on testdb.* to test identified by 'test';
Create a user and modify the permissions.
MariaDB [mysql]> create user u1 identified by 'u1';MariaDB [mysql]> grant insert,update,delete on testdb.* to u1 ;
BTW: hash value of the password.
MariaDB [(none)]> select password('hash');+-------------------------------------------+| password('hash') |+-------------------------------------------+| *06744BAD282D871C1839AF2DF4E6977CD473867F |+-------------------------------------------+