MySQL startup and connection in Windows (image and text)
1. View and start the MySQL service.
After MySQL is installed in Windows XP, it automatically starts the service and has a shortcut connection to the client in the Start Menu, as shown in Figure 4.1.
Fig 4.1
You can view it in the Service Manager of windows. "Start"-"run", enter "services. msc", and press Enter. The Service Manager of Windows is displayed, and the service item "MySQL" is displayed. The service item "started" is displayed on the right, as shown in Figure 4.2.
Fig 4.2
If "started" is not displayed, the MySQL service is not started and cannot be connected. Therefore, the error 10061 is returned. The start method is "start"-"run", enter "cmd", and press enter to bring up the XP command prompt interface (similar to the doscommand line, which will be referred to as the command line later ). Enter "Net start MySQL" to start the MySQL service and stop the MySQL service "net stop MySQL" (note that the MySQL service name is entered here. If your MySQL service name is dB or another name, you should enter "Net start DB" or another name), as shown in Figure 4.3.
Fig 4.3
2. Connect to the MySQL server.
Now, connect to the MySQL server. The command format for connecting to MySQL is:
Mysql-HHost Name-UUser Name-PUser Password
Enter the MySQL directory in the command line, as shown in Figure 4.4.
Fig 4.4
Because I didn't set a password at the beginning, press Enter. If:
Welcome to the MySQL monitor. commands end with; or/g.
Your MySQL connection ID is 1 to server version: 4.1.11-NT
Type 'help; 'or'/H' for help. type'/C' to clear the buffer.
Mysql>
This indicates that the connection to MySQL is successful. "mysql>" indicates that the connection has been successfully established to the MySQL server. You can start msql operations.
"-H host name" can also be written as follows: "-H host name" (no space in the middle), "-- Host = Host Name"
"-U User Name" can also be written as "-u User Name" and "-- user = user name"
"-P User Password" can also be written as "-- Password = User Password ". However, for security reasons, it is best not to do so. Select-P to tell MySQL that you are prompted to enter the password at startup. For example:
Mysql> mysql-hlocalhost-uroot-P
3. Tips.
It is very troublesome to connect to the MySQL server like this. You need to first enter the MySQL directory and then connect to MySQL. Here is a tip to quickly connect to the MySQL server.
"Start"-"All Programs"-"attachments"-"command line prompt", right-click on it, and "send to"-"desktop shortcut ", make a cmd shortcut on the desktop.
Right-click the shortcut, click "properties"-"general" tab, and change the name to "MySQL Command Line ". Go to the shortcut tab and change the start position to "E:/MySQL Server 4.1/bin", including quotation marks.
Next time you connect to the MySQL server, click this shortcut to directly enter the MySQL directory and enter the connection command.
There is also a more convenient technique, as shown in Figure 4.1. There is a "MySQL command line client" on it. Click it and the "Enter Password:" prompt appears. Enter the password and connect to the MySQL server immediately. You don't need to repeat the connection command. However, we recommend that you use the following command to familiarize yourself with the use of commands.