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

MySQL initializes the root password and allows remote access

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

MySQL allows remote access

1. Initialize the root password

Access to mysql database

Mysql > update user set password=PASSWORD ('123456') where User='root'

2. You can use the following three ways to allow mysql remote access:

(1) change the table.

Mysql-u root-pmysql > use mysql;mysql > update user set host ='% 'where user=' root';mysql > selecthost, userfromuser

(2) authorization.

For example, you want root to connect to the mysql server from any host using 123456.

Mysql > GRANT ALL PRIVILEGES ON *. * TO 'root'@'%' IDENTIFIED BY'123456' WITH GRANT OPTION;mysql > flush privileges

If you want to allow the user solin to connect to the mysql server from the host with ip 192.168.119.10, use 654321 as the password

Mysql > GRANT ALL PRIVILEGES ON *. * TO 'solin'@'192.168.119.10' IDENTIFIED BY'654321' WITH GRANT OPTION;mysql > flush privileges

(3) run on the machine where mysql is installed:

/ / enter MySQL server # mysql-h localhost-u root// gives any host the permission to access data mysql > GRANT ALL PRIVILEGES ON *. * TO 'root'@'%' WITH GRANT OPTION;// to make the modification effective mysql > flush privileges;// exit MySQL server mysql > EXIT

Finally: there is a way to see it online.

Vi / etc/mysql/ my.cnf. [client] default-character-set=utf8 [mysqld] character-set-server = utf8collation-server = utf8_general_cibind-address = 0.0.0.0 [MySQL] default-character-set= utf8...

.

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

Wechat

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

12
Report