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

Command collation in mysql

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

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the relevant knowledge of "command arrangement in mysql". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

1. Connect Mysql

Format: mysql -h host address-u user name-p user password

1. Connect to mysql on this machine.

First open the DOS window, then enter the directory mysqlbin , and then type the command mysql -uroot -p, enter the prompt after you enter the password, if you install mysql, super user root is no password, so enter directly into mysql.

The key to mysql is: mysql>

(Note: u and root can not add spaces, the same as others)

Assuming your mysql installation is in C:\Program Files\MySQL\MySQL Server 5.0, if you want to enter the bin directory of mysql, enter dos and enter:

c:

cd "C:\Program Files\MySQL\MySQL Server 5.0\bin"

(Be sure to use double quotes if the folder path contains spaces)

2. Connect to mysql on the remote host

Suppose the IP on the remote host is: 192.168.1.11, the username is root, and the password is: 123456. Type the following command:

mysql -h 192.168.1.11 -u root -p 123456

3. Exit mysql command: exit (Enter).

Second, change the password

Format: mysqladmin -u username-p old password new password

Add a password to root 123456

First go to the mysqlbin directory under DOS and type the following command:

mysqladmin -u root -password 123456

(Note: since root does not have a password at the beginning, the old password of-p is omitted.)

2. Change the root password to abcdefg

mysqladmin -uroot -p 123456 password abcdefg

III. Adding new users

(Note: Different from the above, the following command is a command in mysql environment, so it should be followed by a partial sign as the command terminator)

Format: grant select on database.* to username @ login host identified by \"password\"

For example: add a user test1 password to 123, so that he can log in on any host, and have query, insert, modify, delete permissions for all databases. First connect to mysql as root, and then type the following command:

grant select,insert,update,

delete on *.* to identified by \"123\";

If you don't want test2 to have a password, you can type another command to erase the password.

grant select ,insert,update,delete on mydb.*

to identified by \"\";

The content of "command sorting in mysql" is introduced here. Thank you for reading it. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

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