Python Learning Notes 020--database Basic operations

Source: Internet
Author: User
Tags create database

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.