Mysql has several graphic management software, such as mysql-front and phpadmin, which are easy to use and will not be introduced here. In addition, eclipse has a database management plug-in called, which can be used to manage various commonly used databases in graphs.
The following describes common SQL operations:
You are familiar with creating database tables and querying insert and delete records. These operations are also important for users and passwords, especially when using databases.
Log on to MYSQL
> Mysql-u root-p
> Password
Create user
Mysql> insert into mysql. user (Host, User, Password, ssl_cipher, x509_issuer, x509_sub
Ject) values ("localhost", "fred", password ("love "),'','','');
The created user name is fred and the password is love.
Create a database (test)
Mysql> create database test;
Grant all permissions of the test database to user fred
> Grant all privileges on test. * to fred @ localhost identified by 'love ';
Refresh system permission list
Mysql> flush privileges;
If you want to assign some permissions to a user, you can write as follows:
Mysql> grant select, update on phplampDB. * to fred @ localhost identified by 'love ';
Refresh the system permission table.
Mysql> flush privileges;
Modify the password of a specified user.
> Mysql-u root-p
> Password
Mysql> update mysql. user set password = password ('new password') where User = "fred" and Host = "localhost ";
Mysql> flush privileges;
Delete a user.
> Mysql-u root-p
> Password
Mysql> delete from user WHERE User = "fred" and Host = "localhost ";
Mysql> flush privileges;
Delete a user's database
Mysql> drop database test;
Other useful operations:
List all databases
Mysql> show database;
Switch Database
Mysql> use 'database name ';
List all tables
Mysql> show tables;
Show data table structure
Mysql> describe table name;
Delete databases and data tables
Mysql> drop database name;
Mysql> drop table data table name;