How to use MySQL_MySQL on the command line in Windows 7

Source: Internet
Author: User
This article mainly introduces how to use MySQL in the command line under Windows7 related information, need a friend can refer to me in Win7 installed MySQL version is mysql-5.0.22-win32

1. install MySQL in Windows 7. for details about the installation method, refer to: install MySql 5.5.21 in Windows 7.

2. add the bin in the installation Path of MySQL to the Path environment variable.

If you have experience configuring Java JDK in Windows, you must be familiar with it.

(1) right-click computer> Properties> Advanced system settings on the desktop. the following system properties dialog box is displayed:

(2) click environment variable (N) in the system properties dialog box to bring up the environment variable dialog box.

(3) in the preceding environment variables dialog box, click edit (E) in system variables to find the Path or PATH variable in the system variables, add the bin directory under your MySQL installation path at the beginning.

For example, in my Win7 environment, the MySQL installation Path is: D: \ MySQL Server 5.0, and the bin directory is shown below, so you need to append D to the Path: \ MySQL Server 5.0 \ bin. Note that values must be separated by semicolons.

After modification, my Path variable value is: % JAVA_HOME % \ bin; D: \ MySQL Server 5.0 \ bin; % SystemRoot % \ system32; % SystemRoot %; % SystemRoot % \ System32 \ Wbem; % SYSTEMROOT % \ System32 \ WindowsPowerShell \ v1.0 \; C: \ Program Files \ Microsoft SQL Server \ 100 \ Tools \ Binn \; C: \ Program Files \ Microsoft SQL Server \ 100 \ DTS \ Binn \;
The red character is the binlog of the mysqlexecutable file, which contains binary tools such as mysql.exe1_mysqladmin.exe.

In Linux, environment variables are separated by colons ':', which is different from that in Linux.

3. open the Winodws7 running window by using the Win menu key + R, enter the cmd command in the open edit box, and open the Doc terminal, as shown in:

Here, the Win menu key is the key between the Ctrl Control key and the Alt Shift key in the lower left corner of the keyboard, with the Windows window mark.

4. log on to the MySQL command line interface and connect to MySQL
Enter mysql-hlocalhost-uroot-p123 in the terminal interface to display the MySQL command line interface, as shown below:

Note: the above-h represents the host IP address or domain name, localhost represents the local address 127.0.0.1, and-u represents the MySQL User name, which is the root user during MySQL installation, -p indicates the user password. the password I set when installing MySQL 5.0.22 is 123. You need to enter this information based on your needs.

5. display the MySQL database

We can see that there are four databases in MySQL, of which studb is a newly created database, and the other three are provided by MySQL by default.

6. select a database and use the use database name. The command is as follows:

Suppose that I select my new studb database: use studb;


7. run the SQL query statement. I created a student table in the studb database, and select * from student; run the following:


The student table has three fields: id, name, and math, with four column values.

8. after entering the mysql command line interface, other SQL statements are similar to those in step 1. for more SQL statements, refer to the SQL manual, there is a lot of information on the Internet. In addition, if you want to easily use MySQL, install a GUI tool for MySQL. I personally installed navicat for mysql with the version navicat8_mysql_cs.exe, which is:

Http://download.navicat.com/download/navicat8_mysql_cs.exe, with the registration code, you can find one on the Internet:

Navicat 8.0 registration code
PremiumSoft Navicat for MySQL Enterprise Edition v8.0.27
Name: Bai Bing
Organization: an enterprise-WIN Network Entrepreneurship School
Registration Code (Serial): NAVJ-W56S-3YUU-MVHV

The above is how to use MySQL_MySQL in the command line in Windows 7. For more information, see PHP Chinese network (www.php1.cn )!

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.