Win7 MySQL installation configuration and uninstall note sharing

Source: Internet
Author: User
Tags mysql client

One. Official website: https://dev.mysql.com/downloads/mysql/

1. Select the corresponding version and download the free install version:

2. Do not register account, click "No thanks,just start my download":

3. Download to local after direct decompression:

Two. Start the installation

1. Create a new folder in the D-disk (whichever disk you prefer) MySQL, and then put the Unzip folder in it.

2. Open the folder that you just put in MySQL, modify the contents of the My-default folder in the folder, and rename it to My.ini, and if there is no my-default, it's OK to create a new file called My.ini. have this file or do not have this file does not matter, the contents of you do not understand, are you do not understand the configuration, and then we put the contents of the inside of the configuration we need to be able to, the content I also pasted below.

My.ini content is as follows:

[MySQL]

# Set the MySQL client default character set

Default-character-set=utf8

[Mysqld]

#设置3306端口

Port = 3306

# set up the MySQL installation directory

Basedir=d:\mysql\mysql-5.7.20-winx64

# Set up a storage directory for MySQL database data

Datadir=d:\mysql\mysql-5.7.20-winx64\data

# Maximum number of connections allowed

max_connections=200

# The character set used by the service side defaults to the 8-bit encoded latin1 character set

Character-set-server=utf8

# The default storage engine that will be used when creating a new table

Default-storage-engine=innodb

Note: The content of the diagonal bold two lines of content is your MySQL installation directory and database data storage directory, so you change the content of the My.ini, but also in this sibling folder, a new folder called "Data" to store MySQL data

after the completion of:

Three. Initializing the database

1. Open the terminal command line (what?) What do you mean, command line? Do not explain, own Baidu to go), switch to extract files in the bin directory:

Like me: cd D:\mySQL\mysql-5.7.20-winx64\bin

2. Then continue to enter the following command: Mysqld--initialize--user==mysql--console

The last side of the generated random password cjtchfla16%n (everyone is not the same, only temporarily used for the first time landing, login will change the password) to your little notebook up, the back landing with.

Four. Install MySQL as a system service and start

1. Continue to enter the command in the bin directory just now: mysqld--install MySQL (will be prompted for successful installation)

2. Then continue to enter the command, which is to start the MySQL service: net start MySQL (will be prompted for successful installation)

if the command line input fails to start the service, you can start the service manually by right-clicking on the "Computer" > Management > Services and Applications > services, finding the "MySQL" service , and right-clicking on the service, as follows

3. Then enter the following command to enter the database: Mysql-u root-p (enter password after carriage return) to enter the random password you just recorded on the laptop .

If the above method cannot access the database after you enter a random password, there are ways to:

1. First Win+r, enter services.msc, open the list of services, turn off the MySQL service

2 Open CMD Admin mode and go to the MySQL Bin directory (with the experience you should be familiar with),

Then enter: Mysqld--defaults-file= "D:\mySQL\mysql-5.7.20-winx64\my.ini"--console--skip-grant-tables. (The red part is the directory of your My.ini, be aware)

3. cmd above, then open a cmd in admin mode, also enter the bin directory of MySQL, enter: Mysql-u root-p

The subsequent "Enter password" will not have to enter the password, directly hit "Enter" into the database (is not very amazing?)

4. Then, enter the following SQL statement:

Use MySQL; Show Database changed

Update user set Authentication_string=password ("123") where user= "root"; Display: Query ok,1 rows Affected (0.01 sec) rows matched:1 changed:1 warnings:1

Flush privileges; Display: Query ok,0 rows Affected (0.00 sec)

Quit//exit

Complete so that the root user's password is set to 123.

5. Complete, the next way to run MySQL is to open cmd, enter the command: Mysql-u root-p

Enter password:123 into the database.

6. To set common parameters after the first run:

1) After login, it is necessary to set the root user's password in normal mode, enter: Set Password=password (' 666888 '); (this password is set by yourself, how happy how to come)

2) Open the full permissions of the root operation database:

Use MySQL;

Show tables;

Select Host,user from user;

Update user set host= '% ' where user= ' root ';

Quit

Complete.

7. Then note that before this step, the first cmd is not closed, and then to this step to turn the first cmd off, to successfully restart the MySQL service, can be successfully logged in with Mysql-u root-p and password to enter the database, it means that your MySQL installation succeeded

Here is the wave operation:

(First cmd)

(second cmd, all of the following)

Five. Configure Environment variables

At this point, MySQL installed successfully, but in order not to log into the database every time to switch to the bin directory, we need to set environment variables, so that MySQL can be used in global mode

Right-click Computer > Properties > Advanced system Settings > Environment variables, locate path in the environment variable, then edit path, copy the MySQL bin directory over the path's environment variable, and then save the settings to determine the end.

As follows:

Six. Uninstall MySQL

if a new version of the day or you look at it is not pleasing to the eye, to teach you how to completely uninstall it

1. First stop the MySQL service, cmd mode input net stop MySQL;

2. Go to the Control Panel to uninstall MySQL Server, (if this service is not found in the Control Panel, this step can be omitted)

3. Delete the My.ini file and all files under the MySQL folder;

4. Run the "regedit" file, open the Registry Editor (Win+r Open "Run", enter "regedit" return, there is a registry editor, which is used to clear the registry)

5. Delete the Hkey_local_machine\system\controlset001\services\eventlog\application\mysql folder

Delete the Hkey_local_machine\system\controlset002\services\eventlog\application\mysql folder.

Delete the Hkey_local_machine\system\currentcontrolset\services\eventlog\application\mysql folder (this should not be deleted if it is not.) )

6. Remove the "C:\ProgramData\MySQL" under the C-disk all files, if not deleted with 360 smash can be, the ProgramData file is the default hidden files, the settings are visible after the display, or directly copy the upper address to the Address bar enter to enter!

7. Finally, the MySQL service may still exist:
By using the Windows Installer Clean Up Cleanup tool, the relevant program for the corresponding MySQL database can be completely cleaned up to solve the problem.
However, sometimes you will encounter the problem of wonderful, is to follow all the steps to complete the uninstall, the service is still there is a MySQL related services exist, for this we should delete the relevant services. This is done by opening the CMD Command window as an administrator, and then entering the command in a DOS command:
SC delete mysql//MySQL here is the name of the service you want to delete, and you can delete the related service by this command.
This will completely uninstall MySQL, restart the computer and then re-install MySQL.

Thank you for reading (づ ̄3 ̄) Old

Win7 MySQL installation configuration and uninstall note sharing

Related Article

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.