How to use cmd to connect to the Mysql database bitsCN.com
We usually see mysql tutorials and mysql tool books on the Internet, which contain cmd commands and result sets.
Some beginners may not know which corner of the system to enter these commands, or start some mysql tools. The following describes how to enter the cmd mode of mysql and basic cmd operations of mysql.
Take the window system as an example. First, move the cursor to the lower-left corner to start. click start and find run. after the run is started, enter cmd in the input box ", then press enter to enter the cmd mode (a black window with some English letters ).
Open cmd and we can see: C:/Ducuments and Settings/Administrator> (some of my friends use different systems that are not Administrator users, if the user you use to access the window system is user, the Administrator is changed to user)
In fact, this string of English letters represents a system location. now, the location after cmd is: under the Administrator directory in the Ducuments and Settings directory of drive C, now that we know the location of the cmd, what should we do next? By the way, you need to enter the bin directory of mysql to start mysql with cmd.
Take mysql5.0 as an example. the mysql installation directory is MySQL Server 5.0 (C:/Program Files/MySQL Server 5.0) in MySQL in the Program Files directory of drive C, we are ready to enter this directory.
The procedure is as follows:
C:/Ducuments and Settings/Administrator> cd/(enter key)
The following figure is displayed:
C:/>
Step 2:
C:/> cd C:/Program Files/MySQL Server 5.0/bin (enter key)
Displayed: C:/Program Files/MySQL Server 5.0/bin>
Step 3: (connect to the mysql server)
C:/Program Files/MySQL Server 5.0/bin> mysql-hlocalhost-uroot-p (enter key)
(The above-hlocalhost refers to the connection by a local user,-uroot refers to the connection by a user with the username root, and-p refers to a blank password, generally, you have not set the root user password for beginners. if you have configured the server when installing mysql5.0 and want to set the root password for the first user, remember, after filling in the above-p)
After successful connection, the welcome message of mysql and the mysql version number will appear,
Then the cmd drive letter is:
Mysql>
The connection to the mysql server is successful. then you can see the command in the tool book, which is mysql> command. enter the command here and the result is displayed in cmd.
BitsCN.com