The operation of this database is performed under the Linux virtual machine platform.
1 starting and linking MySQL Service 1.1 server
(1) View service status
Sudo/etc/init.d/mysql stauts
(2) Start the service side
Sudo/etc/init.d/mysql start
(3) Stop the server
Sudo/etc/init.d/mysql stop
(4) Restart service
Sudo/etc/init.d/mysql Restart/reload
1.2 Client Connection Service side
Command format
MYSQL-H host name-u user-p password
If the local server is localhost, the
mysql-hlocalhost-uroot-p123456
In general, you can omit the-H option when you link a local server
mysql-uroot-p123456
2 usage rules for SQL commands
(1) Each command must be comma-terminated;
(2) SQL commands are case insensitive
(3) Use \c to terminate the execution of the command
3 SQL database Basic commands--management of libraries 3.1 naming rules for libraries
(1) You can use letters, _, and numbers, but you cannot use pure numbers
(2) Library name cannot use special characters or MySQL keyword
(3) Library names are case-sensitive
(3) library name is unique
3.2 Basic Operations for libraries
(1) View Gallery: show Databases
(2) Creating library: Create database name default Charset=utf8
1, check the existing library: show databases;
2. Create library (specify character set)
Create database name default Charset=utf8;
3. View the statement that created the library (character set)
Show create database name;
4. View your current library
Select Database ();
5. Switch the Library
Use library name;
6. View existing tables in the library
Show tables;
7. Delete Library
drop database name;
2 SQL Basic command--Library Management 2.1 usage rules for SQL commands
Python Learning Notes 020--database Basic operations