Two methods to implement Mysql remote connection configuration

Two methods to implement Mysql remote connection configuration

Two methods to implement Mysql remote connection configuration

When we work in the company, we often encounter MySQL databases stored on someone's computer. If we want to connect to the MySQL service, the computer with the MySQL service installed must open a remote connection.

The first one:

root@ubuntu:/usr/local/MySQL# mysql -hlocalhost -uroot -proot;

mysql>use mysql;

mysql>insert into user (
 host,
 user,
 password,
 Select_priv,
 Insert_priv,
 Update_priv,
 Delete_priv,
 Create_priv,
 Drop_priv,
 Reload_priv,
 Shutdown_priv,
 Process_priv,
 File_priv,
 Grant_priv,
 References_priv,
 Index_priv,
 Alter_priv,
 Show_db_priv,
 Super_priv,
 Create_tmp_table_priv,
 Lock_tables_priv,
 Execute_priv,
 Repl_slave_priv,
 Repl_client_priv,
 Create_view_priv,
 Show_view_priv,
 Create_routine_priv,
 Alter_routine_priv,
 Create_user_priv,
 Event_priv,
 Trigger_priv,
 Create_tablespace_priv
)VALUES (
'%', //Fixed IP replaces %
'cap',
password('cap'),
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y',
'Y'
);

mysql> FLUSH PRIVILEGES;

Second type:

root@ubuntu:/usr/local/mysql#mysql
 -hlocalhost -uroot -proot;

mysql>GRANT ALL PRIVILEGES ON *.* TO 'test'@'%'IDENTIFIED BY 'test' WITH GRANT OPTION; //Replace % if using fixed IP


mysql> FLUSH PRIVILEGES;

Thank you for reading, I hope it can help you, thank you for your support of this site!

You may also be interested in:
  • MySQL gets the current date and time function
  • A simple way to change the password in MySQL 5.7
  • Detailed explanation of Python MySQL database connection pool component pymysqlpool
  • Detailed tutorial on customizing the installation path of MySQL 5.7.18 version (binary package installation)
  • Use node and express to connect to mysql to implement login and registration code
  • Tutorial on how to deploy php7.1 and enable MySQL extension under CentOS 7

<<:  Detailed explanation of how to exit Docker container without closing it

>>:  Two ways to use react in React html

Recommend

Detailed usage of kubernetes object Volume

Overview Volume is the abstraction and virtualiza...

MySQL data type details

Table of contents 1. Numeric Type 1.1 Classificat...

How to completely uninstall mysql under CentOS

This article records the complete uninstallation ...

Detailed explanation of how to adjust Linux command history

The bash history command in Linux system helps to...

Web standards learning to understand the separation of structure and presentation

When discussing Web standards, one thing that alwa...

Problems encountered in using MySQL

Here are some problems encountered in the use of ...

Detailed explanation of JavaScript's built-in objects Math and strings

Table of contents Math Objects Common properties ...

Detailed explanation of HTML table inline format

Inline format <colgroup>...</colgroup>...

Detailed explanation of common MySQL operation commands in Linux terminal

Serve: # chkconfig --list List all system service...

About CSS floating and canceling floating

Definition of Float Sets the element out of the n...

Install Apple Mac OS X in VMWare12 Graphic Tutorial

1. Introduction: Because my friend wanted to lear...

Example analysis of mysql shared lock and exclusive lock usage

This article uses examples to illustrate the usag...