Simple installation and configuration tutorial for mysql 5.7.14, mysql5.7.14

Source: Internet
Author: User
Tags mysql command line

Simple installation and configuration tutorial for mysql 5.7.14, mysql5.7.14

Record the installation and configuration process of mysql5.7.14, sort out the documents, and hope to help you.

1. configuration document:

#################### Start of the configuration file ################# ### 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. [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-error =" 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 = 1 M tmp_table_size = 32 M thread_cache_size = 8 bytes =" D: \ mysql-5.7.14-winx64/data/"bytes = 1 bytes = 128 M bytes = 128 M innodb_log_file_size = 10 M bytes = 16 innodb-autoextend-increment = 1000 join_buffer_size = 128 M sort_buffer_size = 32 M bytes = 32 M max_allowed_packet = 32 M 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 #################### end of configuration file ################# ##

2. Add Environment Variables

3. Start the service

Net start mysql
MySQL service is starting.
The MySQL service cannot be started.

Solution:Delete content in the data folder
Run the following command:

4. log on to the Access denied for user 'root' @ 'localhost' (using password: NO ).
1). Find the my-default.ini in the root directory of mysql, copy all the content in it,
Create a txt file, copy the content, and change the name to my. ini, note that you need to change the file type to ini, view the file type using the method, and then change the txt suffix to ini. If you do not understand, you can search for it online.
2) In the my. ini configuration file, open the configuration file, find a line in [mysqld], add skip-grant-tables below, save the file, and restart the mysql dynamic service.
---- 1. run cmd to enter the bin directory under Mysql, and enter mysql-u root-p to log on without a password. If password: is displayed, press enter to enter, there will be no ERROR 1045 (28000), but many operations will be restricted because we cannot grant (no permission ).

---- 2. Enter the mysql Database: mysql> use mysql; Database changed

---- 3. Enter update mysql. user set authentication_string = password ('root') where user = 'root ';
Enter update mysql. user set authentication_string = password ('root') where user = 'root'; where password ('') is your future password.

This is because5.7 previous input methods are different.
CauseYes: MySQL5.7 is newly installed. A Password error is prompted during logon. The password is not changed during installation. Later, the password is changed through password-free logon and the update mysql is entered. user set password = password ('root') where user = 'root' ERROR 1054 (42S22): Unknown column 'Password' in 'field list ', it turns out that there is no password field in the mysql database, and the password field is changed to authentication_string, So if you use the previous update mysql. user set password = password ('root') where user], an error is returned.

---- 4. Edit the my. ini file to delete the skip-grant-tables line and restart MySQL. Otherwise, MySQL can still log on without a password.

4. mysql error You must reset your password using alter user statement before executing this statement. Or Your password has expired. To log in you must change it using a client that supports expired passwords.

5. Set the encoding problem (original from: Set MYSQL database encoding to UTF-8)
1) Check the current database code.
Statement:

 show variables like ‘%character%'; show variables like'%collation%';

2) if not, set the mysql encoding to UTF-8. The procedure is as follows:
If "mysql Sever Instance Configuration Wizard" is installed during MySql installation, you only need to start the program and set it accordingly. As described below, you need to set the default encoding to utf8.

If this program does not exist, you need to manually modify the mysql encoding.
1> edit the MySql configuration file
MySql configuration file in Windows is generally in the system directory or in the MySql installation directory named my. ini, you can search, Linux is usually/etc/my. cnf
-- Add the following content under the [mysqld] Tag:
Default-character-set = utf8
Character_set_server = utf8
Note: If the tag already contains content similar to "default-character-set = GBK", you only need to modify it.
-- Add a default-character-set = utf8 line under the [mysql] label
-- Add a default-character-set = utf8 line under the [mysql. server] label
-- Add a default-character-set = utf8 line under the [mysqld_safe] label
-- Add a default-character-set = utf8 line under the [client] label

2> restart the MySql service.
For Windows, you can operate in the service manager or use the command line:
Net stop mysql press ENTER
Net start mysql press ENTER
The service name may not be set to mysql. Set the service name as per your needs.
In Linux, service mysql restart is used.
If the startup fails, check whether the configuration file is set incorrectly.

3> View the setting result
Log on to the MySql command line Client: Open the command line mysql-uroot-p and press enter, enter the password
After entering mysql, run: show variables like "% character % ";
The display result should be similar to 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 not utf8, check the configuration file or use the mysql command to set it:

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;

In addition, you can use the following command to create a database:

create database app_relation character set utf8; use app_relation; source app_relation.sql; 

Command for modifying database encoding: alter database app_relation character set utf8;

The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

Highlights: Installation tutorials for different mysql versions

Install MySql in different versions

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.