Install mysql5.7 and mysql5.7

Source: Internet
Author: User
Tags change settings

Install mysql5.7 and mysql5.7

1. Download the decompressed version from the official website.

 

2. decompress the package and configure the default file.

Create a new my. ini (you can copy a my-default.ini and rename it my. ini ). My. ini replaces the drop-down my-default.ini file.

Modify the configuration file as needed.

# 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
# *** 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 servers, else 10%.
Innodb_buffer_pool_size = 600 M # (Mysql Data Cache size, adjusted based on your memory size and needs)

# 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: \ Program Files \ mysql57 # (Mysql directory path)
Datadir = C: \ Program Files \ mysql57 \ data # (Mysql database path, which is the data folder in the root directory by default, note that if this path is changed, you must copy the files in the original data directory. Otherwise, error 1067 will be reported)

Character-set-server = utf8 # (default server character, consistent with the above)
Port = 3306 # (Mysql port, default 3306)
Server_id = 11


# 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 = 128 M (memory used for Join Operations)
# Sort_buffer_size = 2 M (memory used for sorting)
# Read_rnd_buffer_size = 2 M (memory used for random data buffer READING) (the above three settings are based on your own situation)

SQL _mode = NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLES

 

3. Install the mysql Service

Enter a token in the search box, and a token will be displayed. Click "cmd.exe" on the right to run as an administrator.

Switch the directory to the bin directory of the extracted file, and enter mysqld install and press enter to run the command. Note that mysqld is not mysql. If the installation is successful, it will be OK.

 

4. initialize the data folder

Switch the directory to the bin directory of the extracted file and run mysqld -- initialize-insecure.

(If you run mysqld -- initialize, a random password is generated, which is troublesome. See the official website: http://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization-mysqld.html)
There is no data folder in the MySQL 5.7.6 decompression file, so Initialization is required to generate a data folder and fill in the relevant tables in the system database.

 

5. Start the mysql Service

Enter net start mysql to start the service. You can also choose "right-click this computer-Manage-service" to manually enable it (simple way to open the Service Interface in win7: Open the task manager and click the service ).

 

6. Modify the root password

Run mysql-u root-p and press enter for the password. After entering, change the password. mysql> alter user 'root' @ 'localhost' identified by 'your password ';

 

7. Set Environment Variables

Although mysql is enabled, it is annoying to enter so many commands to switch directories every time you open mysql? How can this problem be solved?

Right-click my computer-> properties-> advanced system settings-> environment variables-> path-> edit, and put the full path of the bin directory under your mysql software. Add a semicolon (;) to the path of the directory to save it. Such as D: \ mysql \ mysql-x.x.xx-winx64 \ bin;

Why? Simply put, the path in the environment variable is the directory path of the cmd system. How does the system know if the command has been entered? What did the system do? In fact, the system searches for all paths in the current directory and path of the system environment variable. If the first path is found, an error is returned. So we do not need to switch the cmd directory every time, or set it, and we do not need to switch the cmd path in the future. For example, the system is like a bus. Follow the established route. The path in the environment variable is the route or station. When you arrive at the station (find the first one), get off (run ).

(Reference: http://jingyan.baidu.com/article/597035521d5de28fc00740e6.html)

 

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.