First, MySQL installation and system environment settings
General MySQL package is divided into two kinds of installation package and compression package.
The installation package ends with an. msi, click on the prompts to select Install.
After unpacking the compressed package, copy the folder to the location you want to install, such as C:\Program files\mysql, you need to set environment variables after the copy completes, right-click My Computer-"properties-" advanced-"environment variable, in the pop-up window to find the variable named path of the system variable to edit, Add the path information of the bin directory under the MySQL installation directory in the variable value, such as; C:\Program Files\mysql\bin; (Before the path if there is no semicolon, it is best to add one to differentiate).
Set the environment variable after editing the MySQL installation directory My-default.ini file, found in the file "# Basedir =" and # "DataDir =" These two lines are modified to:
basedir = MySQL installation directory (example C:\Program files\mysql5.6)
DataDir = MySQL Data directory (example C:\Program files\mysql5.6\data)
The installation of MySQL is now complete. Programs installed through the installation package can choose to bring your own manager to graphically manage MySQL, or you can manage it by downloading other visual management tools.
Second, MySQL management commonly used commands
The following are some of the commands used to manage MySQL daily under the command line.
1. Connect the database: Enter "cmd" in Start Menu-"Run" to open the command window, execute mysql-u root-p Enter, the default password is empty, enter directly.
2. When executing a single command in the Mysql> view, you need to add ";" after the command. As the end, otherwise it will go into the ">" View and let you continue to enter the command statement, enter ";" In the ">" View. Start executing the command and enter the end of the "\c" interrupt.
3. Exit: Exit MySQL after entering exit enter
4. Change Password and crack password: The default installation of MySQL after the root user does not have a password, there are several ways to change the password:
(1) Using Set Password modification: After logging in to MySQL, enter set password for ' root ' @ ' localhost ' = password (' new password ') in mysql> view;
(2) Mysqladmin: Enter the mysqladmin-u user name-p password Password "New password" at the command prompt. (Note: I found in the changes to-p and password can not have a space, otherwise it will let you enter the password, use the correct password is not, do not know the other children's shoes is not the same)
(3) Edit user table with update: After logging in to MySQL, enter use mysql;update user set password = password (' new password ') in mysql> view where user = ' root '; flush Privileges;
(4) crack root password: First stop the MySQL service, enter net stop MySQL at the command prompt or stop the MySQL service in the Control Panel-"Administration Tools-" service. Then start MySQL in safe mode at the command prompt into the MySQL bin directory: Perform Mysqld.exe--skip-grant-tables. Open a new CMD window and log in to MySQL using the Update Edit user table (refer to the above Change Password Method 3). After restarting the MySQL service, enter the test with the new password to be able to log in normally.
Crack password may encounter the MySQL service can not start, error 1067, at the command prompt into the MySQL installation directory in the bin directory, execute mysqladmin-u root-p shutdown, enter the modified password, restart MySQL. Or, end the MySQL-related process in Task Manager and restart MySQL.
Install mysql5.6 and basic commands under Windows