Common MySQL database management commands: bitsCN.com
Guide: common commands for MySQL database management.
Install Mysql using the RPM Package and set iptables for TCP port 3306.
Root password Management sets the root user password mysqladmin-uroot password.
Modify the password of the root user mysqladmin-uroot-p password.
Database and table management go to mysqlmysql-h hostname-uroot-p.
Create mysql> create database location.
Import the data structure mysql-uroot-p location <./location. SQL.
View the database mysql> show databases;
Enter a database mysql> use location;
View table information mysql> show tables;
View the table structure mysql> desc Contact;
Change the table name mysql> rename table Contact to Contact_new.
Delete database mysql> drop database location.
Delete a table mysql> drop table Contact.
The authorization section creates a user and authorizes mysql> grant all on location. * to gk1020@10.1.11.71 identified by gk1020.
Unauthorize mysql> revoke all on location. * from gk1020@10.1.11.71.
Refresh the permission mysql> flush privileges.
The operation statement queries mysql> select * from Contact.
Mysql> select count (*) from Contact.
Modify mysql> update Contact set RegTime = '2017-01-01 00:00:00 'where id = 1.
Mysql> update Contact set RegTime = '2017-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 the exported database locationmysqldump-uroot-p location>./location. SQL.
Export a table mysqldump-uroot-p -- database location -- table Contact>./contact. SQL.
Export the database location data structure mysqldump-d-uroot-p location>./location. SQL.
Copy table copy table Contact is Contact_bakmysql> create table Contact_bak as select * from Contact.
Copy the table Contact structure mysql> create table Contact_bak as select * from Contact where 1 = 2.
View the running task mysql> show processlist.
BitsCN.com