MySQL Learning notes 04-mysql startup and connectivity

Source: Internet
Author: User
Tags command line connect mysql client mysql command line
mysql| notes
(Note: Reprint and quote, please indicate author Saulzy)







First, view and start the MySQL service.



After installing MySQL under Windows XP, it has started the service automatically and has a shortcut connection to its client in the Start menu, as shown in Figure 4.1.











Figure 4.1







Can be viewed through the Windows Service Manager. "Start"-"Run", enter "Services.msc", carriage return. Windows Service Manager pops up, and then you can see the service item with the service name "MySQL," which is labeled "Started" on the right, as shown in Figure 4.2.









Figure 4.2







If you do not have the word "started", the MySQL service does not start and cannot connect, and a 10061 error occurs. Startup method is: "Start"-"Run", input "cmd", enter the XP command prompt interface (similar to the DOS command line, hereafter referred to as the command line). Then enter "net start MySQL" to start the MySQL service, stop MySQL service "net stop MySQL" (Note that here is the name of the MySQL service entered.) If your MySQL service name is DB or other name, you should enter "net start DB" or other name, as shown in Figure 4.3.









Figure 4.3







Second, the connection MySQL server.



Now start connecting to the MySQL server, the command format to connect to MySQL is:



Mysql–h Host name –u user name –p user password



Enter the MySQL directory at the command line, as shown in Figure 4.4.









Figure 4.4



Since I did not set the password at the beginning, it is OK to press ENTER directly. If it appears:



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 means that the successful connection MySQL, "mysql>" description has been successfully connected to the MySQL server, you can start the operation of the mSQL.



"-H host name" can also be written: "H hostname" (no space in the middle), "--host= host name"



"-u username" can also be written: "-u user Name", "--user= User name"



"-P user password" can also write: "--password= user password." However, for security reasons, it is best not to do so. Select-p to tell MySQL not to password to prompt you to type the password at startup. For example:



Mysql>mysql-hlocalhost-uroot-p







31 Little tips.



Like this connection MySQL server is troublesome, need to enter the MySQL directory, and then connect MySQL. Here's a little trick to quickly connect to a MySQL server.



"Start"-"All Programs"-"Attachments"-"command line Prompt", right click on the top, "Send To"-"desktop shortcuts", and make a shortcut to cmd on the desktop.



Then right click on the shortcut, "Properties"-"General" tab, change the name to "MySQL command line." Go to the Shortcuts tab and change the start position to "E:\MySQL Server 4.1\bin", including quotes.



The next time you connect to the MySQL server, click on this shortcut directly into the directory of MySQL, directly enter the connection command.



There is also a more convenient technique, as shown in Figure 4.1. There is a "MySQL Command line Client", click on it, appear "Enter password:" Prompt, enter the password, immediately connected to the MySQL server, the connection commands do not have to knock. However, it is recommended to use the above command mode, you can familiarize yourself with the command.







(Note: Reprint and quote, please indicate author Saulzy)










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.