Initial contact with MySQL

Source: Internet
Author: User
Tags mysql command line

MySQL has been engaged in development for several years, but there are few opportunities for accessing MySQL in terms of databases. Recently, I took over the project using MySQL in terms of data. Therefore, I am also a little bit worried about learning and writing down what I learned to deepen my memory! Www.2cto.com To be honest, I have never used MySQL in terms of databases, either SQL Server or Oracle. When SQL Server or Oracle is used, the client query is used instead of the command line query. I learned that MySQL also has a client query tool Navicat for MySQL, but with a learning mentality, I still directly use the command line to query.
First, install MySQL. Because MySQL has never been used, I am afraid that errors may occur during installation, and the parameter settings are incorrect. So I found some information on the Internet and taught me how to install MySQL. For specific installation methods, see www.jb51.net/article/23876.html. After installing the software, you can access the software through the command line. When you click MySQL Command Line Client in the Start menu, you are prompted to enter the logon password. This login password is prompted during the installation file. You can log on to MySQL software only after you enter the correct password.
After the correct password is entered, the following characters are displayed in the command line: Welcome to the MySQL monitor. commands end with; or \ g. your MySQL connection id is 5 to server version: 5.0.19-nt. type 'help; 'or' \ H' for help. type '\ C' to clear the byffer.
When traveling with the above characters, it means that you have successfully logged on. The MySQL statement is ended with a semicolon. Therefore, when you enter any command, it is best to end. Although some commands do not require semicolons, most commands need to end with semicolons. After logging on to the system, there is a black screen in front of us, apparently there is nothing we need. At this point, we need to first determine which databases exist on the database software. At this point, you can enter the following command: show databases; because in windows, it is generally case insensitive, So I enter lowercase characters here. The preceding statement indicates that MySQL displays all databases in the form of a list when querying all databases in the software. When you find the database of the required data, assume that the database is test, and the database that comes with MySQL. Use the following statement to use the database: www.2cto.com use test; then, the database is used. The following is a list of tables under the data, which is similar to the database name query. The show: show tables command is also used to display the data tables under the test database in the form of a list. Because we are a newly installed software, obviously, there is no table in the test database. Command Line prompt: Empty set (0.00sec)
The following is a pet table. Input: create table pet (name VARCHAR (20), owner VARCHAR (20), species VARCHAR (20), sex CHAR (1), birth DATE, death DATE); apparently, anyone who has used SQL knows the meaning of the preceding statement. After the preceding table is inserted and show tables is entered again, the pet table is displayed in the query results. Author Yan Bing's xiadong

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.