MySQL database is an open-source Relational Database Management System. MySQL database system uses the most common database management language-Structured Query Language (SQL) for database management, mySQL database management has its own unique command. The following describes common commands for MySQL database management.
MySQL database is an open-source Relational Database Management System. MySQL database system uses the most common database management language-Structured Query Language (SQL) for database management, mySQL database management has its own unique command. The following describes common commands for MySQL database management.
MySQL databaseManagement is a crucial part for the database. To understand the management of the MySQL database, you must start from the basics. Only the commands used in database management are first known, the actual operation is much easier. Below isMySQL Database ManagementCommon commands:
- Install Mysql using the RPM package and set iptables for TCP port 3306.
- Root password Management sets the root user's password mysqladmin-uroot password 'Password '.
- Modify the root user password mysqladmin-uroot-p password '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.
- In the authorization section, create a user and authorize 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.
Note:
Location is the database name, and Contact is the table name.
You can understand these common commands for MySQL database management and apply them in actual operations. If you are familiar with them, the Common commands for MySQL database management will be easy.