1. Log in to MySQL database
View the user table mysql> use mysql; Database changed mysql> select host,user,password from user; +--------------+------+-------------------------------------------+ | host | user | password | +--------------+------+-------------------------------------------+ | localhost | root | *A731AEBFB621E354CD41BAF207D884A609E81F5E | | 192.168.1.1 | root | *A731AEBFB621E354CD41BAF207D884A609E81F5E | +--------------+------+-------------------------------------------+ 2 rows in set (0.00 sec) You can see the root user that has been created in the user table. The host field indicates the host being logged in. Its value can be either IP or host name. (1) If you want to log in using your local IP address, you can change the Host value to your own IP address. 2. Realize remote connection (authorization method) Changing the value of the host field to % means that you can log in to the MySQL server as the root user on any client machine. It is recommended to set it to % during development. Change the permissions to ALL PRIVILEGES mysql> use mysql; Database changed mysql> grant all privileges on *.* to root@'%' identified by "password"; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> select host,user,password from user; +--------------+------+-------------------------------------------+ | host | user | password | +--------------+------+-------------------------------------------+ | localhost | root | *A731AEBFB621E354CD41BAF207D884A609E81F5E | | 192.168.1.1 | root | *A731AEBFB621E354CD41BAF207D884A609E81F5E | | % | root | *A731AEBFB621E354CD41BAF207D884A609E81F5E | +--------------+------+-------------------------------------------+ 3 rows in set (0.00 sec) This way the machine can remotely access MySql on the machine with the username root and password root. 3. Realize remote connection (table modification method) use mysql; update user set host = '%' where user = 'root'; In this way, you can access MySQL remotely through the root user. If you have any additions, please contact the editor of 123WORDPRESS.COM. You may also be interested in:
|
<<: How to install Android x86 in vmware virtual machine
>>: JavaScript style object and CurrentStyle object case study
MyISAM storage engine The MyISAM storage engine i...
Table of contents cause reason Introduction to NP...
When Docker creates a container, it uses the brid...
Table of contents background Importing virtual fi...
Table of contents Introduction effect principle f...
Table of contents 1. Demand Background 2. Optimiz...
The img tag in XHTML should be written like this:...
Preface: This article mainly introduces the conte...
Table of contents 1.union: You can add query resu...
Table of contents 1. RegExp object 2. Grammar 2.1...
Table of contents 1.MySQL adds or subtracts a tim...
Table of contents Preface: Encryption algorithm: ...
This article example shares the specific code of ...
1: Installation command pip install docker-compos...
<body> <div id="root"> <...