1. Official website path:
(1) Personally choose version 5.7.22
(2) Because the local network speed is slow, choose wget to download directly to the linux server.
(3) Mysql download url is: https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz
(4) Start downloading, prompt: -bash: wget: command not found
Solution: yum -y install wget
(5) After the installation is successful, continue wget to download mysql.
(6) After the download is complete, install it.
Unzip
, rename,
assign permissions ,
check whether dependencies are installed ,
initialize mysql command , and
initialize error: there is no such folder
. Solution: create the required folder in the root directory and
re-initialize mysql
Note: the red location is the password
(7) Modify the Mysql configuration file
basedir: database Installation location bindir: mysql bin path datadir: database file storage location
sbindir libexecdir
(8) Modify the my.cnf file
[client]
no-beep
socket =/yearns/mysql-5.7.22/mysql/mysql.sock
# pipe
# socket=0.0
port=3306
[mysql]
default-character-set=utf8
[mysqld]
basedir=/yearns/mysql/mysql-5.7.22
datadir=/mysql-5.7.22/data
port=3306
pid-file=/yearns/mysql/mysql-5.7.22/mysqld.pid
#skip-grant-tables
skip-name-resolve
socket = /yearns/mysql/mysql-5.7.22/mysql.sock
character-set-server=utf8
default-storage-engine=INNODB
explicit_defaults_for_timestamp = true
#不区分大小写
lower_case_table_names=1
# Server Id.
server-id=1
max_connections=2000
query_cache_size=0
table_open_cache=2000
tmp_table_size=246M
thread_cache_size=300
#限定用于每个数据库线程的栈大小。默认设置足以满足大多数应用
thread_stack = 192k
key_buffer_size=512M
read_buffer_size=4M
read_rnd_buffer_size=32M
innodb_data_home_dir = /mysql-5.7.22/data
innodb_flush_log_at_trx_commit=0
innodb_log_buffer_size=16M
innodb_buffer_pool_size=256M
innodb_log_file_size=128M
innodb_thread_concurrency=128
innodb_autoextend_increment=1000
innodb_buffer_pool_instances=8
innodb_concurrency_tickets=5000
innodb_old_blocks_time=1000
innodb_open_files=300
innodb_stats_on_metadata=0
innodb_file_per_table=1
innodb_checksum_algorithm=0
back_log=80
flush_time=0
join_buffer_size=128M
max_allowed_packet=1024M
max_connect_errors=2000
open_files_limit=4161
query_cache_type=0
sort_buffer_size=32M
table_definition_cache=1400
binlog_row_event_max_size=8K
sync_master_info=10000
sync_relay_log=10000
sync_relay_log_info=10000
#批量插入数据缓存大小,可以有效提高插入效率,默认为8M
bulk_insert_buffer_size = 64M
interactive_timeout = 120
wait_timeout = 120
log-bin-trust-function-creators=1
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
#
# include all files from the config directory
!includedir /etc/my.cnf.d
(9) Start mysql to
log in to the mysql database
Error solution:
The file location is wrong, just modify etc/my.cnf. The correct location is: /yearns/mysql-5.7.22/mysql.sock
(10) Log in to the mysql database and change the password
Change the password alter user 'root'@'localhost' identified by 'root';
quit exit
(11) Close the firewall, prohibit Startup
At this point, you can connect to the database remotely through a third-party tool.
Attachment: self-start mysql command at boot
1. Copy the service file to init.d and rename it to mysql
cp /yearns/mysql/mysql-5.7.22/support-files/mysql.server /etc/init.d/mysqld
2. Give executable permission
chmod +x /etc/init.d/mysqld
3. Add service
chkconfig --add mysqld
4. Display service list
chkconfig --list
If you see the mysql service, and 3, 4, and 5 are all on, it is successful, if it is off, type in
chkconfig --level 345 mysqld on
5. Restart the computer
reboot
6. Verify
netstat -na | grep 3306
If you see a monitor, the service is started