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)