Installation |
Installing MySQL with RPM packages |
|
Setting the TCP 3306 port iptables |
|
|
Root Password management |
Set the root user's password |
mysqladmin-u root password ' password ' |
To modify the root user's password |
mysqladmin-u root-p password ' password ' |
|
Database, table Management |
Go to MySQL |
Mysql-h Hostname-u Root-p |
Create a database |
Mysql> CREATE DATABASE location |
Import data Structures |
Mysql-u root-p Location <./location.sql |
View Database |
mysql> show databases; |
Enter a library |
mysql> use location; |
View table Information |
Mysql> Show tables; |
View table Structure |
mysql> desc Contact; |
Change table name |
Mysql> Rename table Contact to Contact_new |
Delete a library |
Mysql> DROP Database Location |
Delete a table |
mysql> drop TABLE Contact |
|
Authorization section |
Establish users and authorize |
Mysql> Grant all on location.* to [e-mail protected] ' 10.1.11.71′identified by ' gk1020′ |
Cancel Authorization |
Mysql> revoke all on location.* from [email protected] ' 10.1.11.71′ |
Refresh Permissions |
Mysql> Flush Privileges |
|
Action Statement |
Inquire |
Mysql> SELECT * FROM Contact |
Mysql> Select COUNT (*) from Contact |
Modify |
mysql> Update Contact Set regtime= ' 2008-01-01 00:00:00 ' where id=1 |
mysql> Update Contact Set regtime= ' 2008-01-01 00:00:00 ', cid=1 where id=1 |
Insert |
mysql> INSERT into contact values ("," ...) |
mysql> INSERT into contact (id,cid,contact) VALUES ("," ...) |
Delete |
Mysql> Delete from contact where id=1 |
|
Export |
Export Database Location |
Mysqldump-u root-p Location >./location.sql |
Export a table |
Mysqldump-uroot-p–database location–table Contact >./contact.sql |
Export data structure of database location |
mysqldump-d-uroot-p Location >./location.sql |
|
Copying tables |
Copy table contact for Contact_bak |
Mysql> CREATE TABLE Contact_bak as SELECT * from Contact |
Duplicating the structure of a table contact |
Mysql> CREATE TABLE Contact_bak as SELECT * from Contact where 1=2 |
|
View the tasks that are being performed |
|
Mysql> Show Processlist |
|
|
|
Description |
Location for library name, contact for table name |