Home > Database > Mysql Tutorial > mysql5.7.13 environment setup tutorial (unzipped version)_MySQL

mysql5.7.13 environment setup tutorial (unzipped version)_MySQL

WBOY
Release: 2016-08-20 08:48:13
Original
1195 people have browsed it

I recently decided to learn databases. After comparing various databases, I chose to start with mysql. The main reasons are:
•Open source
•Mature and versatile
•Large number of users and complete community
•Easy to get started

1. Download and install
The official website download address of mysql: http://dev.mysql.com/downloads/mysql/
There are two versions available for download on the mysql official website, namely the client version (Recommended Download, which is also the recommended version on the official website) and the uncompressed version (Archive). What I chose here is the decompressed version. Click download to download. After downloading, directly decompress the compressed package to the target path where you want to install mysql.
I downloaded version 5.7.13. After unzipping, I got a mysql-5.7.13-winx64 folder, which contains the following files:
2016/07/18 14:34

.
2016/07/18 14:34
..
2016/07/18 14:34
bin
2016/05/25 13:50 17,987 COPYING
2016/07/18 14:34
docs
2016/07/18 14:33
include
2016/07/18 14:34
lib
2016/05/25 14:08 1,141 my-default.ini
2016/05/25 13:50 2,478 README
2016/07/18 14:34
share
3 files 21,606 bytes 7 directories 118,994,726,912 available bytes

At this point, the download and installation is complete

2. Configure mysql

1. Configure my.ini
I renamed the mysql-5.7.13-winx64 file here to mysql (the original file name is too long). The my-default.ini under this file is the default configuration file. We need to re-implement the configuration here: change my- Copy default.ini and rename it to my.ini, and replace the file directories of basedir, datadir and other parameters with the path to the directory where your own mysql is located.

 # For advice on how to change settings please see
 # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
 # *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
 # *** default location during install, and will be replaced if you
 # *** upgrade to a newer version of MySQL.
 [mysqld]

# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M

# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin

# These are commonly set, remove the # and set as required.
basedir = C:\mysql
datadir = C:\mysql\data
# port = .....
# server_id = .....


# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

Copy after login

The mysql file here is placed under the c drive, so just fill in the "c:/mysql" in the above file with your own file path and it will be ok.


2. Configure environment variables
Add the path of your mysql bin folder to PATH, it’s very simple, not much to say.

3. Run mysql
Run cmd as administrator (must run as administrator) and enter the mysql bin file

mysqld --remove mysqld --install
mysqld --initialize //A data folder will be generated
net start mysql //Start the mysql service

After executing these three commands in sequence, open the data folder and find the error file type file under it. This file is the log log of this mysql initialization, including the initialization password. If "root@localhost is created with an empty password !" is displayed, it is empty. Then execute

mysql -uroot -p
Enter the user name and password, and if "Type 'help;' or 'h' for help. Type 'c' to clear the current input statement." is displayed, the connection is successful.

4. Login error
If there is a problem when logging in and "Access denied for user 'root'@'localhost'" is displayed, you can try to reset the root password:
1. Modify the /my.ini file, add skip-grant-tables under [mysqld], and then start mysql

2. Then log in to MySQL using the root user with an empty password;


mysql -u root

3. Change the root user’s password;


 mysql> update mysql.user set password=PASSWORD('新密码') where User='root'
mysql> flush privileges;
mysql> quit
Copy after login

4. Restart MySQL and you can log in with the new password.

The above is the entire content of this article. I hope it will be helpful to everyone’s study and I hope you will support me a lot.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template