one, MySQL installation
1th step, yum install MySQL
[Email protected] ~]# yum-y install Mysql-server
Installation Result:
Installed:
Mysql-server.x86_64 0:5.1.73-3.el6_5
Dependency installed:
mysql.x86_64 0:5.1.73-3.el6_5 perl-dbd-mysql.x86_64 0:4.013-3.el6 Perl-dbi.x86_64 0:1.609-4.el6
2nd step, set boot start
[Email protected] ~]# chkconfig mysqld on
3rd step, start the MySQL service
[[Email protected] ~]# service mysqld start
4th step, set the root user password for MySQL
[Email protected] ~]# mysql-u root
Welcome to the MySQL Monitor. Commands End With; or \g.
...... Some lines are omitted
Mysql> select User,host,password from Mysql.user;
To query the user's password, all empty, set the root password to root with the following command
mysql> Set password for [email protected]=password (' root ');
Mysql> exit
5th step, login with new password
[Email protected] ~]# mysql-u root-p
6th step, Basic command
show databases; To view a database that already exists on the system
Use Databasesname; Select the database you want to use
Drop database databasename; Delete the selected database
Exit//Disconnect from database
Create Database test01; To create a database named Test
Show tables; List the tables under the current database
Other basic additions and deletions using standard SQL
7th Step, open Telnet permission
GRANT all privileges on * * to ' root ' @ '% ' identified by ' root ' with GRANT OPTION;
FLUSH privileges; second, open remote connection
MySQL for security, by default users are allowed to log on locally only, but in this case, you still need to use the user for remote connection, so that they can be remotely required to do the following:
First, allow the root user to telnet anywhere, and have all the library operation permissions, the following: (verified)
Log in to MySQL using the root user first:
Mysql-u root-p "Youpassword"
To authorize the operation:
Mysql>grant all privileges on * * to ' root ' @ '% ' identified by ' Youpassword ' with GRANT OPTION;
Overload Authorization Table:
FLUSH privileges;
To exit the MySQL database:
Exit
Second, allow the root user to telnet in a specific IP, and have all the library operation permissions, the following:
Log in to MySQL using the root user first:
Mysql-u root-p "Youpassword"
To authorize the operation:
Grant all privileges on * * to [email protected] ' 172.16.16.152 ' identified by ' Youpassword ' with GRANT OPTION;
Overload Authorization Table:
FLUSH privileges;
To exit the MySQL database:
Exit
Third, allow the root user to telnet in a specific IP, and have all the library-specific operation rights, the following:
Log in to MySQL using the root user first:
Mysql-u root-p "Youpassword"
To authorize the operation:
GRANT select,insert,update,delete On * * to [e-mail protected] "172.16.16.152" identified by "Youpassword";
Overload Authorization Table:
FLUSH privileges;
To exit the MySQL database:
Exit
Iv. Remove user authorization, need to use the revoke command, the specific command format is:
REVOKE privileges on database [. Table name] from User-name;
For specific instances, first log in to MySQL:
Mysql-u root-p "Youpassword"
To authorize the operation:
GRANT Select,insert,update,delete on Test-db to [e-mail protected] "172.16.16.152" identified by "Youpassword";
Then delete the authorization action:
REVOKE all on test-db from Test-user;
Note: This action only clears the user's authorization rights for TEST-DB, but this "test-user" user still exists.
Finally, clear the user from the user table:
DELETE from user WHERE user= "Test-user";
Overload Authorization Table:
FLUSH privileges;
To exit the MySQL database:
Exit
V. MySQL permissions detailed classification:
Global Administrative permissions:
File: Read and write files on the MySQL server. 
PROCESS: Displays or kills service threads that belong 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 of the table.  
Drop: Deletes a data table or database.  
Index: Establishes or deletes an index.  
INSERT: Adds a record for the table.  
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: Allow login only-nothing else is allowed.
[Go]centos6.5 use yum to install mysql-configure MySQL to allow remote logins