Installation and configuration of MySQL under WINDOW10

Source: Internet
Author: User
Tags mysql download mysql login

download MySQL
Official website Download MYSQL5.7.21 version, link address https://www.mysql.com/downloads/. Download the flowchart as follows:

Enter the official dot click community, download the community version.

Locate the MySQL Community Server and click download below to access the download page.

Swipe to the bottom of the page, the official website provides the different computer bits (32/64 bit) download version, My computer is win10-64 bit, select the corresponding version to download the decompression package.

If you do not register to login to download the page, the official website will prompt you to register an account to download, of course, you can also select the Red Line Callout section, do not need to register to download the MySQL unpacking package.
install MySQL
MySQL official website provides the download package is the ZIP archive format file, this file only needs to decompress does not need to install, or you may think that the decompression is installs, the download good installation package extracts to the disk which you want to install, I here default is the system disk C, extracts as follows:

You can see that after extracting to the C drive there will be a file named Mysql-5.7.21-winx64, click to view the sub-directory under this folder as follows:

Windows system to cut out the cmd black window, in command line mode into the subdirectory of the installation directory just MySQL bin, I have just installed in the C drive, so into the C:\mysql-5.7.21-winx64\bin directory,

Then enter the installation command Mysqld-install in the C:\mysql-5.7.21-winx64\bin directory, such as:

Some students enter these installation commands will appear in the Red label error, that is, install/remove of the service denied! (Installation/uninstallation services are denied), this is due to system permissions issues, That is, we open the cmd window is not run as an administrator, the following we re-open the cmd window as an administrator, enter the C:\mysql-5.7.21-winx64\bin directory, and then enter the installation command Mysqld-install, as follows:

At this point you MySQL has been installed successfully (happy under^▽^), but if you want to call MySQL you must also complete the following configuration work (heart tired, MMP).
Configure MySQL
Or in the cmd command line mode, after entering the C:\mysql-5.7.21-winx64\bin directory, enter the command mysqld–initialize, the carriage return to execute the command after a short while to wait, This process will generate a data folder under the Mysql-5.7.21-winx64 directory of MySQL, with a file with a suffix named. Err ending, which contains a temporary random password generated when MySQL was first used (MYSQL5.7 above will generate a A random password, we need to find this password to log in using). To open this. err file in Notepad you can find a random password for my:




After finding the random password, let's configure the MySQL startup file, create a new. ini format file My.ini under the MySQL directory mysql-5.7.21-winx64, and then open the following code in Notepad format:

[mysqld]basedir=C:\mysql-5.7.20-winx64datadir=C:\mysql-5.7.20-winx64\dataport=3306
    • 1
    • 2
    • 3
    • 4

Note that the above basedir, datadir behind the drive letter is you choose to unzip the path of MySQL disk, I am here to decompress in the C drive. Save close after writing the above code.
Then we start the MySQL service and enter the following command:

start mysql
    • 1


Enter the following command to log in to MySQL:

-u root -p
    • 1


The Red Line Callout section is the random password we asked to enter when we first used MySQL, which we have already found in the. err file, which you can enter here. At this point we have successfully configured MySQL, but in order to facilitate the use of MySQL login, we can set the password each time you log in to MySQL, enter the following command to set the login password:

set password for [email protected]=password(‘xxxxxx‘);
    • 1

where xxxxxxx is your own password, do not forget that there is an English-language symbol in the back of this command; Oh, the password setting will be displayed when it is successful:

So far, you have successfully installed and configured MySQL, but another problem is that we used the command mysql-u root-p to log in to MySQL with this command in C:\mysql-5.7.20-winx64\bin, If the next time you open the cmd window you enter the login command, you may not be able to recognize the command, so here we can set the environment variables of the system, so that each time you open the CMD window can directly call the mysql login command.
system environment variable configuration

Locate the System Properties and enter the environment variable settings

Select path in the system variable to edit, create a new path, this path is your MySQL decompression path, I here is C:\mysql-5.7.20-winx64\bin\. After setting the environment variable, we re-open cmd black window, call MySQL login using command mysql-u root-p, enter the login password you have set up, enter MySQL.

OK, see this you should be able to take a breath, MySQL download, installation and configuration has been completed, of course, you can not wait to enter some SQL simple statement test under the MySQL health, such as enter the following command to view the current database:

show databases;
    • 1


Enter the command quit, quit MySQL:

Installation and configuration of MySQL under WINDOW10

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.