The following articles mainly describe the basic usage of common MySQL statements. First, we will introduce the basic usage of common MySQL statements by adding users. The following is a detailed description of the article, I hope you will understand the actual application after browsing.
1. Add a user
- GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
- flush privileges;
2. remote connection
- use MySQL;
- update user set host='%' where user='root';
3.
- MySQL -u root MySQL
- MySQL> UPDATE user SET Password = PASSWORD('newpwd')
- -> WHERE User = 'root';
- MySQL> FLUSH PRIVILEGES;
This statement is required to take effect in common MySQL statements.
4. Create an index:
- MySQL> alter table name add index (field );
- MySQL> alter table name add primary key (field );
- MySQL> show columns from table name;
Except index:
- MySQL> alter table Name drop index field;
- MySQL> alter table Name drop primary key field;
- MySQL> show columns from table name;
5. Backup
- MySQL\bin>MySQLdump -u root -proot orapp > back.sql
The above content is an introduction to common MySQL statements.
The above content describes common MySQL statements, hoping to help you in this regard.