MySQL 5.7.14 installation configuration simple tutorial _mysql

Source: Internet
Author: User
Tags change settings mysql code create database mysql command line

Record mysql5.7.14 installation and configuration process, combing the written, hope to help everyone.

1. Configuration Documentation:

################### #配置文件开始 ################### # for advice on ' How to ' change settings, please. # http://dev.mysql.com /doc/refman/5.7/en/server-configuration-defaults.html # * * * does not EDIT this FILE. It's a template which'll be copied to the # * * * * * * * * * * * * * * * * * * * * location during install, and would be replaced if u

 Pgrade to a newer version of MySQL. [Client] Default-character-set=utf8 [mysqld] port=3306 basedir = "D:\mysql-5.7.14-winx64" DataDir = "D:\mysql-5 .7.14-winx64/data/"Tmpdir =" d:\mysql-5.7.14-winx64/data/"socket =" D:\mysql-5.7.14-winx64/data/mysql.sock "Log-err Or= "D:\mysql-5.7.14-winx64/data/mysql_error.log" #server_id = 2 #skip-locking max_connections=100 Table_open _cache=256 query_cache_size=1m tmp_table_size=32m thread_cache_size=8 innodb_data_home_dir= "D:\mysql-5.7.14- winx64/data/"Innodb_flush_log_at_trx_commit =1 innodb_log_buffer_size=128m innodb_buffer_pool_size=128m Innodb_lo g_file_size=10m InnoDB_thread_concurrency=16 innodb-autoextend-increment=1000 join_buffer_size = 128M sort_buffer_size = 32M Read_rnd_bu Ffer_size = 32M Max_allowed_packet = 32M explicit_defaults_for_timestamp=true sql-mode= "strict_trans_tables,no_auto_ Create_user,no_engine_substitution "Skip-grant-tables #sql_mode =no_engine_substitution,strict_trans_tables ######
 ############# #配置文件结束 ###################

2. Add Environment variables

3. Start Service

net start MySQL
The MySQL service is starting.
The MySQL service failed to start.

Problem Resolution: Delete the contents of the Data folder
Then enter the following command:

4. Login Access denied for user ' root ' @ ' localhost ' (using Password:no) Problem resolution
1. Find My-default.ini in the root directory where MySQL is located, copy everything inside,
Create a TXT document, copy the content into, and then save the name changed to My.ini, note that the file type should be changed to INI, the way to view the file type, and then the txt suffix to ini, if you do not understand the Internet to find.
2. My.ini configuration file, open the configuration file, find a [mysqld] line, add skip-grant-tables below to save the file, restart the MySQL dynamic service.
----1. Through the cmd into MySQL under the bin directory, input mysql-u root-p can not password login, appear password: When direct return can enter, will not appear error 1045 (28000), but many operations will be restricted, Because we can't grant (without permission).

----2. Access to MySQL database:mysql> use mysql;database changed

----3. Enter Update Mysql.user set Authentication_string=password (' root ') where user= ' root ';
Enter the update mysql.user set Authentication_string=password (' root ') where user= ' root ', where password (') is your future password.

The reason for the repetition is that it is different from the previous input method of 5.7 .
The reason is: Newly installed MySQL5.7, login prompt password error, installation and did not change the password, and then password-free login to change the password, input update mysql.user set Password=password (' Root ' where user= ' root ' Prompts for error 1054 (42S22): Unknown column ' Password ' in ' field List ', the original MySQL database has no password This field, password field changed to Authentication_string, so if you follow the previous update mysql.user set password= Password (' root ') where user] will complain.

----4. Edit My.ini File Delete Skip-grant-tables this line, and then restart MySQL, otherwise MySQL can still password-free login.

4.mysql error You must reset your password the using ALTER USER statement before executing this statement. Or your password has Expired. To log in and must change it using a-client that supports expired passwords.

5, set the coding problem (original from: set MySQL database code for UTF-8)
1), check the current database encoding.
Use statements:

 Show variables like '%character% ';
 Show variables like '%collation% ';

2, if it is not the case, the MySQL code needs to be set to Utf-8. The specific steps are as follows:
If the MySQL Sever Instance Configuration Wizard is installed when you install MySQL, you only need to start the program to set it up accordingly. As described in the screenshot below, the default encoding needs to be set to UTF8.

If you do not have the program, you need to manually modify the MySQL code.
1>, edit MySQL configuration file
MySQL configuration files under Windows general under the System directory or in the MySQL installation directory named My.ini, you can search, Linux is generally/etc/my.cnf
--Add the following to the [mysqld] Label:
Default-character-set = UTF8
Character_set_server = UTF8
Note: If the "DEFAULT-CHARACTER-SET=GBK" content already exists under this label, simply modify it.
--Add a line under the [MySQL] tab default-character-set = UTF8
--Add a line default-character-set = UTF8 under the [Mysql.server] Label
--Add a line to the [Mysqld_safe] tab default-character-set = UTF8
--Add a line to the [Client] tab Default-character-set = UTF8

2>, restart the MySQL service
Windows can operate in Service Manager, or you can use the command line:
net stop MySQL carriage return
net start MySQL carriage return
the service name may not necessarily be MySQL, please press your own settings
Linux under the service MySQL restart
If a startup failure occurs, check to see if the configuration file is set incorrectly

3>, viewing Settings results
Login to MySQL command line client: Open command line mysql–uroot–p carriage return, enter password
After entering MySQL execution: show variables like "% character%";
The results should resemble the following:
| character_set_client | utf8 |
| character_set_connection | UTF8 |
| Character_set_database | UTF8 |
| Character_set_results | UTF8 |
| Character_set_server | UTF8 |
| Character_set_system | UTF8 |
| Character_sets_dir | /usr/share/mysql/charsets/|

If the encoding is still not UTF8, check the configuration file, or use the MySQL command to set:


Set character_set_client = UTF8;
Set character_set_server = UTF8; Set character_set_connection = UTF8; Set character_set_database = UTF8; Set character_set_results = UTF8; Set collation_connection = Utf8_general_ci; Set collation_database = Utf8_general_ci; Set collation_server = Utf8_general_ci;

Additionally: You can use the following command when you create a database:

Create database app_relation character set UTF8; 
Use app_relation; 
SOURCE App_relation.sql; 

The command that modifies the database encoding is:ALTER DATABASE app_relation character set UTF8;

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

Wonderful topic sharing: MySQL different versions of the installation Tutorials mysql5.7 version Installation Tutorials

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.