3 Basic operation of MySQL
Above we learn how to install a database, then this section we come to know the database;
we are after MySQL installation, in the data directory will automatically generate several necessary databases, you can use SHOW DATABASES Statement to query the current database of all existing (note that the query results and permissions are related, if there is no login then can only query to the first and fourth):
where MySQL is a must, he describes the user access rights, users often use the test database to do the work of testing. Creating a database is essentially dividing a region on disk for data storage and management, which can be used directly if the administrator creates a database for the user when setting permissions, otherwise it is necessary to create the database yourself. Let 's take a look at MySQL creation.
3.1 creating databases, viewing databases and database definitions
all operations on the data are database-based, so creating a database is our contact One of the most basic operations of DB, the syntax for creating a database is as follows:
CREATE DATABASE db_name;
Practice
CREATE DATABASE test_db;
Show databases;// View Database
Show CREATE database test_db;// view DB definition
3.2 Deleting a database
Deleting a database is a very cautious thing, because Deleting a database does not give you any hints, and deleting the database will remove all data from the database and not restore .
The database has been deleted
SHOW CREATE DATABASE test_db;
The database definition cannot be queried at this time
3.3 Selecting a database
Above we learn the deletion and switching of the database, then if you switch to use the database, fake into you suddenly need to go to another database to operate it?
Use MySQL;
Rookie rise DB Chapter 3 basic operation of MySQL 5.6