Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to connect remotely with MySQL in Linux server

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how MySQL remote connection in Linux server, the article is very detailed, has a certain reference value, interested friends must read it!

msyql database installed on Linux server, can be accessed locally, but I want to access it remotely, after querying the data, I found that MySQL installation under Linux is completed by default, only local access rights, no remote access rights, you need to set access rights for specified users to remotely access the database.

preface

Learn MySQL to reorganize previous non-MK records

described

2003-can't connect to MYSQL

method/step

·First step

Remotely connect to Linux and make sure MySQL is installed on Linux. Log in to the database.

mysql -u$user -p $pwd

·Step 2

Create a user to connect remotely

GRANT ALL PRIVILEGES ON *.* TO '$username'@'%' IDENTIFIED BY '$password' WITH GRANT OPTION;

$username means username, % means all computers can connect, or you can set an ip address to run the connection,$password means password

·Step 3

Execute flush privileges; command takes effect immediately

FLUSH PRIVILEGES;

·Step 4

Users querying the database

SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;

·Step 5

The requested URL/etc/mysql/my.cnf was not found on this server.

bind-address = 127.0.0.1

Set to bind-address = 0.0.0.0 (device address)

restart

/etc/init.d/mysql restart

·View MYsql global port (default is 3306 )

#View port number

show global variables like 'port';

Configuration is complete.

The above is how MySQL remote connection in Linux server all the content, thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report