Login to connect mysql
1 connecting to MySQL
Mysql-h host Address- u user name - p password
Example 1: Assume that the IP of the remote host 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 )
2 exit mysql command:
Exit
3 Change Password
Mysqladmin-u Username- p old password password new password
Add new users and Modify permissions for MySQL
1 grant permissions on the database. * to User name @ login host identified by "password";
Grant All on * * to * to * to User name @ login host identified by "Secret code "; # This user has all of the permissions for all databases.
2 Create User: For creating new users account (starting with the 5.0 version of this command), when creating this user does not assign any permissions, need to be created after the grant command to assign the appropriate permissions to the user.
eg:create user [email protected] identified by ' 123456′;
Grant Select on mydb.* to [email protected];
3 Drop User: Delete a subscriber account
eg:drop user Guest;
4 Rename User : Can be implemented to rename a user account.
5 Grant: Used to administer access, that is, to authorize user accounts. Of course it can also create a new user account.
eg:
Grant SELECT, INSERT, UPDATE, delete on new_db.* to [email protected] '% ' identified by ' 888′;
grant permissions on the database. Table to user @ Access mode identified by password Grant Select on mydb.* to [e-mail protected] identified by ' 123456;
BTW: If you need a blank password or a password-free account, you must first use the Create User command, and then grant to assign permissions. If you do the following: grant all privileges the mydb.* to [email protected] '% ';
in the Database user table, the visitor is not created first user, the following error occurs:
"Can ' t find any matching row in the user table".
Grant can only create an account with a password.
6 Revoke: Delete an account, see MySQL documentation for details
Reference: http://see.xidian.edu.cn/cpp/u/mysql_ml/
This article is from the "Tiandaochouqin" blog, make sure to keep this source http://luzhi1024.blog.51cto.com/8845546/1655471
MySQL login connection, add user, modify permissions