MySQL (ii)

Source: Internet
Author: User

Install MySQL on Windows

Installing MySQL on Windows only requires downloading the Windows version of the MySQL installation package and extracting the installation package.

Double-click the Setup.exe file to complete the installation.

Next, you can switch to the bin directory of the installation location in CMD and enter the following command:

Mysqld.exe--console

If the installation succeeds the above command will output some MySQL boot and innodb information.

Verifying MySQL Installation

After a successful installation of MySQL, some base tables are initialized, and after the server is started, a simple test can be done to verify that MySQL is working properly.

Use the Mysqladmin tool to get the server status:

The binary file is located in the bin directory of the installation location.

Mysqladmin--version

The following results are output after the command, which is related to the system:

Mysqladmin  8.425.7.   Win64 on x86_64

If the above command does not output any information after execution, the installation is not successful.

Execute a simple SQL command using MySQL client

You can connect to the MySQL server using MySQL commands on the MySQL client (MySQL clients). The command is as follows:

Mysql-u root-penter password:**********

The above command will output the mysql> prompt, which indicates that you have successfully connected to the MySQL server and can execute the SQL command at the mysql> prompt:

Mysql> Showdatabase                                                      
-

MySQL CREATE database using Mysqladmin to create a database

The following command simply demonstrates the process of creating a database with the data name Ruboob:

Mysqladmin-u root-p create testdbenter passwaord:**********

After successful execution of the above command, MySQL database TestDB will be created.

MySQL Create data table

Creating a MySQL data table requires a bit of information:

    • Table name
    • table field Name
    • Define each table field
Grammar

The following is the general SQL syntax for creating MySQL data tables:

CREATE TABLE table_name (column_name column_type);
To create a table from the command prompt

The mysql> Command window makes it easy to create a MySQL data table with the following examples of creating a data table employee:

Mysql-u root-penter password:**********mysql> Use testdb;database changedmysql> CREATE TABLE EMPLOYEE (      first_name VARCHAR) notNULL,      last_name VARCHAR (+) NOT NULL,      --age INT NOT null      , and SEX VARCHAR (TEN) NOT NULL ,       INCOME INT not NULL,
-employee_id INT not NULL auto_increment, PRIMARY KEY (employee_id) );
Query OK, O rows Affected (0.50 sec)

Note: The MySQL command Terminator is a semicolon (;).

MySQL (ii)

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.