Basic MySQL-basic database operations
1. Delete the database drop database name;
Mysql> drop database test;
Delete database mode
2. create DATABASE name;
Mysql> create database test;
In Windows and Linux, database names and table names are processed differently. In Windows, database names and table names are case-insensitive, while in Linux, database names are case-sensitive.
3. Create a dedicated user for database operations
Syntax Rules:
Create a new user and GRANT the database operation permission grant all privileges on database name. * TO username @ localhost identified by password
Mysql> grant all privileges on test * TO user $ localhost identified by '20140901 ';
This grants the user who connects to the database from the local database ALL the permissions (all privileges) to operate on ALL objects in the home database ). Permissions are used to measure the operations that a user can perform on the database. CREATE (CREATE) SELECT (Search) UPDATE (UPDATE) DELETE (DELETE) and other permissions are used. In addition, in the [test. *] section, perform operations on specific tables in the database.
4. log on to the database as a user
Mysql>-u user-p
Enter password :******
5. database used
USE the specified database USE Database Name
Mysql> use home;
6. If you forget the specified database when using the MySQL monitor, you can use the SELECT command to view the currently used database.
Displays the currently used database select database ();
Mysql> select database ();