Resource Sharing-MySQL database Basics

Source: Internet
Author: User

Author: zhangguozhong
Date: 2007-5-12

MySQL version: 5.0.27

1. Start the database.
Command: Net start MySQL
Net stop MySQL
2. Connect to the database:
CMD --> mysql-uusername-ppassword

3. Show:
Show databases;
Show tables;

4. Create a database, create tables, and add constraints...
Create Database dataname.
Drop database dataname
Create Database tablename
Drop table tablename
Delete from tablename -- delete data
Update tablename set pass = '20140901'
5. display table structure
Describe tablename;
6. Import the. SQL File
Source E: My. SQL
7. view the version
Select version ();
Select current_date ();
8. Pi
Select Pi ();
9. View users:
Select User ();
10. Load command (import file ):
Load data local infile "F:/My. SQL" into Table tablename;
11. Remove duplicate rows using distinct.
12. null value operation
13. pattern matching (fuzzy query)
14. function application.

15. The detailed query SQL statement is the same as that in SQL Server2000.
16. database connection:

Try
{
Class. forname ("org. gjt. Mm. MySQL. Driver ");
Conn = drivermanager. getconnection ("jbdc: mysql: // localhost/dbname", "username", "password ");
}
Catch (exception ex)
{
 
}

Problem:
1. How does MySQL Save the script. SQL file ????
2. Check multi-table data. Besides writing advanced query statements, is there any visualization ????
 

Learning...

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.