There are a lot of friends, although installed
MySQLBut I don't know how to use it. In this article, we will learn some common MySQL commands from connecting MySQL, changing passwords, and adding users.
First, connect MySQL.
Format: mysql-h host address-u user name-P user Password
1. Example 1: Connect to MySQL on this machine.
First, open the DOS window, then go to directory Mysqlbin, and then type the command mysql-uroot
-P, enter after the prompt you lose password, if just installed MySQL, superuser root is no password, so directly enter into MySQL, MySQL prompt is:mysql>
2. Example 2: Connect to MySQL on the remote host. Assume the remote host IP is: 110.110.110.110, the user name is root, the password is abcd123. Type the following command:
Mysql-h110.110.110.110-uroot-pabcd123
(Note: You and root can be used without spaces, others are the same)
3. Exit MySQL command: Exit (enter)
Second, change the password.
Format: Mysqladmin-u username-P Old password password new password
1, Example 1: Add a password to root ab12. First enter directory Mysqlbin under DOS, and then type the following command
Mysqladmin-uroot-password AB12
Note: Because Root does not have a password at the beginning, the-p old password can be omitted.
2, Example 2: Then change the root password to djg345.
MYSQLADMIN-UROOT-PAB12 Password djg345
Third, add new users. (Note: Unlike the above, the following is because it is a command in a MySQL environment, so it is followed by a semicolon as a command terminator)
Format: Grant Select on database. * To User name @ login host identified by
Password
Example 1, add a user test1 password for ABC, so that he can log on any host, and all databases have query, insert, modify, delete permissions. First, use the root user to connect to MySQL, and then type the following command:
Grant Select,insert,update,delete on *.
http://www.bkjia.com/PHPjc/631016.html www.bkjia.com true http://www.bkjia.com/PHPjc/631016.html techarticle There are a lot of friends who have installed MySQL but don't know how to use it. In this article we will connect MySQL, change passwords, add users and so on to learn some of the common life of MySQL ...