Summary of MySQL5.7.19 installation in Linux, linuxmysql5.7.19
For the first time, I encountered a lot of problems when installing mysql on my own virtual machine. Here I will share with you.
linux centOS 6
Mysql versionmysql-5.7.19-linux-glibc2.12-x86_64.tar.gz
1,groupadd mysql
# Add a mysql Group
2,useradd -r -g mysql mysql
# Add a user
3. decompress the downloaded package,tar -xzvf /usr/local/mysql-5.7.13-linux-glibc2.5-x86_64.tar.gz
4,mv /usr/local/mysql-5.7.13-linux-glibc2.5-x86_64 /usr/local/mysql
# Rename
Directory after decompression:
5,mkdir /usr/local/mysql/data
# This folder is not used to store data by default
6,chown -R mysql:mysql ./
# Enter the mysql package and authorize this package to mysql
7,chgrp -R mysql:mysql ./
# Entering the mysql package
8,bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
# Enter the mysql file name basedir as the mysql path, and datadir as the mysql data package, which contains the mysql package, such as the user
Many tutorials on the Internetmysql_install_db
The installation method is the same as that at the beginning. various errors and failures are reported. The mysql_install_db command is not recommended. Just follow the above command.
Note the generated temporary password, as shown in the preceding figure: YLi> 7 ecpe; YP
9,bin/mysql_ssl_rsa_setup --datadir=/usr/local/mysql/data
10. Enter mysqlsupport-file
11,cp my-default.cnf /etc/my.cnf
No such version is found.my-default
This is the time for us to create one (Internal Code) by ourselves: the values of the two sockets (red) below must be consistent; otherwise, the link will not be available after startup.
# Dvice 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] SQL _mode = NO_ENGINE_SUBSTITUTION, STRICT_TRANS_TABLES # general configuration options: basedir =/usr/local/mysql datadir =/usr/local/mysql/data port = 3306 # socket =/temp/mysqld. sock socket =/var/run/mysqld. sock character-set-server = utf8 # The following are optional and can be used. If a startup error occurs, comment it out and retain the most basic configuration options, then try to add some configuration items and then start, check whether the configuration item is incorrect back_log = 300 max_connections = 3000 max_connect_errors = 50 table_open_cache = 4096 max_allowed_packet = 32 M # bytes = 4 M bytes = 128 M bytes = 16 M sort_buffer_size = 16 M bytes = 16 M thread_cache_size = 16 query_cache_size = 128 M bytes = 4 M bytes = 8 thread_stack = 512 K transaction_isolation = REPEATABLE-READ tmp_table_size = 128 M # log-bin = mysql-bin long_query_time = 6 server_id = 1 bytes = 1G bytes = 16 bytes = 16 M innodb_log_file_size = 512 M bytes = 3 bytes = 90 bytes = 120 innodb_file_per_table = on [mysqldump] quick max_allowed_packet = 32 M [mysql] no- auto-rehash socket =/var/run/mysqld. sock default-character-set = utf8 safe-updates [myisamchk] key_buffer = 16 M sort_buffer_size = 16 M read_buffer = 8 M write_buffer = 8 M [mysqlhotcopy] interactive-timeout [mysqld_safe] open -files-limit = 8192 [client] loose-default-character-set = utf8
12,cp mysql.server /etc/init.d/mysql
13,vim /etc/init.d/mysql
# Modify basedir = your own path modify datadir = your own path
14,bin/mysqld_safe --user=mysql
& ## Start mysql
13,./mysql -uroot -p
# Under the bin directory
14. Enter the temporary password
15. Modify the MySQL root Password
At this time, mysql only supports access from the local localhost.
16 Modify remote access
Restart MySQL Service
MySQL can be used locally
Test remote connection
Summary
The above is a summary of installing MySQL5.7.19 in Linux. I hope it will be helpful to you. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!