Basic use of MySQL

Source: Internet
Author: User

Java has been tested yesterday afternoon, and there is still a database principle this afternoon, so I have no plans to write anything. I came back this afternoon and played mysql. I used it before, I used MYSQL as a source code from the Internet. In fact, MySQL is used in a very large amount, but I have never used it very much, because I always feel it is very troublesome and I have to enter commands on the console! So it has never been easy to use. Compared with sqlserver, it has a much better experience and a friendly interface, but now I suddenly find it a good bird ~ This is because the machine is running at a severe speed. In the past, it was okay to open three DOTNET and sqlserver. Now I am engaged in Java and start myeclipse. I feel that resources are occupied. When I open several other webpages, the warning box pops up, prompting that the memory is insufficient ~ I don't know if it's ie7.0 or what ~ Depressing ~~ Some time ago, I was preparing to add a 1G note, but the money was tight and I was about to move soon. I had to spend some money, and my roommate sent me five hundred yuan, I was planning to let him pay back, but he is also very nervous at the moment. In fact, I do not like to urge people to pay back the money, because I always feel that others must have difficulties, otherwise they will pay back. So I will wait for a while, but I will not rush it!
Well said back to MySQL, on the machine to find a half-day MySQL Installation Software, depressing is really not found, had to go down from the http://www.mysql.com official website, but there is only 16 MB, haha, it is really good. It is too much space-saving compared to Oracle, but its function is basically much faster than Oracle's installation process, and it will be done in two minutes, while Oracle ~~ Three dishes, depressing ~! There is no need to pay attention to the installation. The only note is that the encoding format should be set to gb2312, and a root password should be set!

OK. Write the basic usage of MySQL for future reference ~~~ I am afraid that I have forgotten it for a while. In fact, I have used it before, but I haven't touched it for too long, so I forgot it, So I went online to find information ~ Trouble ~
 
MySQL usage:
Create a database

Create   Database Yourdatabasename; -- Enter! (Note that each command statement ends with a semicolon)

Show all databases:

Show databases;

Show all tables:

Show tables;

View the table structure:

Desc Yourtablename; -- Description.

Run the following command to import the SQL file:

\. C: \ mysqlfile. SQL; -- (Add a backslash and a file path)

MySQL page:

Select   *   From   User   Order   By Newtime Desc Limit 3 , 3 ; -- Read 4th to 6th entries in the table! These three messages!

Compared with SQL Server's identity (), MySQL's auto-incrementing column definition uses auto_increment. when inserting a record, set this column to null! Or add the specified column!

Date

  Select Now (); -- Get current time!

Adjust the date format:

Select Date_format (now (), ' % Y-% m-% d % H: % I: % s ' );

Insert a Date Field: '2017-08-15 10:27:56 '. A string is automatically converted to the date format internally!

In addition, I have heard of a friend who said that MySQL also has interface operations. Today I found a client software ~ MySQL administrator, not big, less than 2 MB. Today I just installed it and looked at it in English. I will study how to use it later!
In fact, now I understand why many people use MySQL. First, it is relatively small and N saves hard disk resources, especially system disks. The biggest benefit is that it saves system resources, both sqlserver2005 and Oracle have at least 1 GB of memory required for the system!
So I plan to use it later ~~~
It's almost the same. The rest is the SQL statement. I used to use the query analyzer on SQL Server, so I am familiar with it and don't need to write it! It was a little more than, and there were tests and database theories in the afternoon ~ Hurry to bed ~~~

-- Say goodnignt to myself!
Related Article

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.