Install MySQL under window

Source: Internet
Author: User

Reference Address: https://www.cnblogs.com/lmh2072005/p/5656392.html

First, download the installation package

Open MySQL official website download page: http://dev.mysql.com/downloads/mysql/

Select the appropriate version and platform

Here the choice is 5.7.13 version 64-bit compression package, the file is larger than 310M.

Click Download to enter the real download page, found to login to download, to be careful will find below there is no thanks, just start my download. Just click on this link to do it.

Unzip the download to the appropriate directory, where it is uniformly placed under C \

After decompression according to their favorite folder changed to name mysql-5.7.20, all of the MySQL files are in this directory: C:\mysql-5.7.20-winx64\mysql-5.7.20-winx64

Second, MySQL configuration

Open the folder just unpacked C:\wamp-all\mysql-5.7.13, found that there is a My-default.ini configuration file, this is the default configuration file, copy a change of their name for My.ini

Edit My.ini to configure the following basic information:

1234567891011121314151617 [mysql]# 设置mysql客户端默认字符集default-character-set=utf8[mysqld]# 设置3306端口port = 3306# 设置mysql的安装目录basedir=C:\wamp-all\mysql-5.7.13# 设置mysql数据库的数据的存放目录datadir=C:\wamp-all\sqldata# 允许最大连接数max_connections=20# 服务端使用的字符集默认为8比特编码的latin1字符集character-set-server=utf8# 创建新表时将使用的默认存储引擎default-storage-engine=INNODB

Iii. install and start MySQL

Open the CMD command-line tool as an administrator and right-click to be the Administrator

, CD to unzip the file's Bin directory: C:\mysql-5.7.20-winx64\mysql-5.7.20-winx64, directly available

Enter mysqld install to run, the installation will be successful.

Input net start MySQL start MySQL (or open Windows service to start MySQL manually)

Startup found in cmd, no boot.

Search on the Internet The discovery is 5.7 version has this problem, to manually initialize the data directory in the bin directory

CD to the bin directory before initializing

1. Mysqld--initialize-insecure automatically generate a password-free root user,

2. mysqld--initialize automatically generate root user with random password

Choose 1 Mysqld--initialize-insecure here

After initialization, run net start MySQL to successfully start MySQL.

Iv. entering the MySQL environment

1. Cmd to the bin directory to execute mysql-uroot (no password required),

2. Set a password for the user: mysqladmin-u root-p password, error when setting password: Access denied for user ' root ' @ ' localhost ' (using Password:yes)

is because the localhost root user is not authorized, a new user is created here, and then authorized to
Create user ' test ' @ ' localhost ' identified by ' your password ';
Grant all privileges on * * to [email protected] ' localhost ';
Run these two SQL statements in MySQL and enter the password again with Test's identity

3. In the command line type: Mysql-utest-p Enter, and then enter the password you just set to enter.

If you want to exit the SQL environment and return to the normal CMD environment, enter exit return. Enter MySQL again to execute 3rd.

V. Execute SQL statements

show databases; You can see the default database

Use MySQL;

Show tables;

select * from user;

......

VI. Configuring environment variables

If you do not want the CD to the MySQL bin directory every time, you can configure the environment variables, the cmd command executes the mysql instruction will go to the environment variables to find the corresponding path.

Right-click My Computer, properties, advanced system settings, environment variable->path-> edit, will download the full path of the extracted MySQL bin directory inside: C:\mysql-5.7.20-winx64\ mysql-5.7.20-winx64; multiple separated by semicolons.

VII. Testing the PHP connection database

$con = Mysqli_connect ("localhost", "Test", "123456"); Var_dump ($con);

Found an error: Call to undefined function mysql_connect did not find this method, found several methods on the internet, tossing for 1 hours, the final discovery is the problem of PHP configuration, extension_dir= "ext" Change to absolute path: Extension_dir = "C:/wamp-all/php-5.6.23/ext" Restart Apache.

Refer to the solution for call to undefined function mysql_connect (): http://www.blogjava.net/koradji/articles/336713.html

Reference Documentation:

1. http://dev.mysql.com/downloads/file/?id=463242

2. http://jingyan.baidu.com/article/597035521d5de28fc00740e6.html

3. http://bbs.csdn.net/topics/391851148//Resolve 5.7 Startup issues

4. Http://zhidao.baidu.com/link?url=J26PKMHhHv1fPpiPEwSCOSKMKhpdbgjOzwW6B6ZMk075FtzOE_nRcE982Zo_ Ititd5zqcal0izl7ewlhnpgm6w1ufunuceloyef-uvyvaws

Install MySQL under window

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.