One, connect MySQL Enter the MySQL installation directory; $ bin/mysql-p [host IP if login local mysql can not write-P direct-U]-u [userName]-P input password, enter, successive;
Second, permission operation [if you know the MySQL database very well, you can modify the system table directly and then flush privileges with mysql>. Command for permission to take effect]
1. Empowering mysql>grant all[permission name, all means all permissions] privileges on [dataBaseName * * = ALL libraries] to [username]@[ip,% table not arbitrary IP] identified by [PA ssWOrd, can be empty] with GRANT OPTION;
2. Revoke Permissions mysql> revoke all[permission name, all for all permissions] on [dataBaseName * * for all Libraries] from [USERNAME]@[IP, please use% for any IP];
Note: MySQL permissions are categorized in detail:
Global Administrative permissions:
File: Read and write files on the MySQL server.
PROCESS: Displays or kills service threads belonging to other users.
RELOAD: Overloads the Access Control table, refreshes the log, and so on.
SHUTDOWN: Turn off the MySQL service.
Database/data Table/Data column permissions:
Alter: Modifies an existing data table (for example, add/Remove Columns) and index.
Create: Create a new database or data table.
Delete: Deletes the record for the table.
Drop: Deletes a data table or database.
Index: Establish or delete the indexes.
INSERT: Adds a table record.
SELECT: Displays/searches the table's records.
UPDATE: Modifies a record that already exists in the table.
Special permissions:
All: Allow to do anything (as root).
USAGE: Only allow login-nothing else is allowed.
Third, user-level operation
1. New User
2. Change the password
Iv. Database-level operations
1. New Library
2. Display Database mysql>show databases;
3. View the database Mysql>use [DatabaseName]
4. View the currently connected database
V. Operation of the table
1. New Table
2. Delete a table
3, change the name of the table
4. New PRIMARY Key
5. Modify the primary key
6. Delete primary key
7. New FOREIGN key
8. Modify the foreign key
9. Delete foreign keys
10. Add Unique Keys
11. New Fields
12. Modify Fields
13. Delete Fields
Vi. Data manipulation
1. Query setting format
2. Insert INTO Select
Vii. Backup
1. Export the entire database, import the speed of the library
2. Export a table, import a table
3, export the structure of the database, import database structure
Other operations:
1. Show MySQL version mysql> Select version ();
2. Show Current Time mysql> Select Now ();
This article from the "11247808" blog, reproduced please contact the author!
MySQL operation instructions