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

Basic Operation of Mysql based on linux operating system (1)

2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Basic Operation of Mysql Based on Linux Operating System (1)

Background introduction: mysql soft connection establishment, ln -s /usr/local/mysql/bin/mysql /usr/bin

1. Log in locally, command:

#mysql -uroot (user)-p123456 (password)

2. Remote login, command:

#mysql -uroot (user)-h292.168.1.111 (source IP address, equivalent to client IP)-p123456 (password)

3. Authorize a source ip remote user, command: (The following command is for authorization operations on the database server)

mysql -uroot -p123456 #Log in to the database first

use mysql;#Use database

grant all on *.* to 'root'@192.168.1.108identified by '123456';#Grant root all permissions for all libraries and tables under 192.168.1.108, authentication password is 123456. Screenshots are as follows:

Note: If 192.168.1.108 is replaced by %, it means all ip.

Refresh command: flush priviledges;

To view the new authorized ip user, command:

#select * from user where host='192.168.1.108'\G; screenshot is as follows:

Then you can log in remotely to the database!

4.Mysql default listening port is 3306, how to achieve remote login when the port number changes? The order reads as follows:

#mysql -uroot -h292.168.1.108 -P3306 -p123456

5. Mysql uses sock to log in remotely, with the following command:

#mysql-uroot -S /tmp/mysql.sock -p123456

6. To see which libraries are in the database, command:

#show database;

7. To see which tables are in a library, command:

#use discus;

#show tables;

8. To view the format of a table in a library, command:

#describe pre_common_admincp_cmenu;

Note: field indicates field

9. To see how a table was created, command:

#show create table pre_common_admincp_cmenu\G;

10. To see where the user logged in from, command:

#select user();

11. To see which library you are currently in, command:

#select database();

12. Command to invoke the system, command:

#system ls;

13.select version ();#View mysql version

14.show status;#Check mysql status

15. View mysql maximum number of connections, show variables like'max_connect %'; percent sign indicates wildcard

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