Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Installation example method of mysql5.7

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "the installation instance method of mysql5.7". In the daily operation, I believe that many people have doubts about the installation instance method of mysql5.7. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "installation instance method of mysql5.7". Next, please follow the editor to study!

Example one

[root@localhost] # / usr/local/mysql/bin/mysqld-initialize-user=mysql-basedir=/usr/local/mysql/-datadir=/data/3306/data

2017-03-03T07:04:07.762686Z 1 [Note] A temporary password is generated for root@localhost: uE70uYprtw?d

[root@localhost ~] # vi / data/3306/my.cnf

[client]

Port = 3306

Socket = / data/3306/soket/mysql.sock

[mysql]

No-auto-rehash

[mysqld]

Server-id = 1

User = mysql

Port = 3306

Socket = / data/3306/soket/mysql.sock

Basedir = / usr/local/mysql

Datadir = / data/3306/data

Open_files_limit = 10240

Back_log = 600,

Max_connections = 3000

Max_connect_errors = 6000

Table_open_cache = 614

External-locking = FALSE

Max_allowed_packet = 32m

Thread_cache_size = 300

Query_cache_size = 64m

Query_cache_limit = 4m

Default-storage-engine = InnoDB

Thread_stack = 19K

Transaction_isolation = READ-COMMITTED

Tmp_table_size = 256m

Max_heap_table_size = 256m

Long_query_time = 4

Slow_query_log_file=/data/3306/logs/slow-log.log

Slow_query_log

Log-bin = / data/3306/logs/ray-bin.log

Binlog_cache_size = 4m

Max_binlog_cache_size = 8m

Max_binlog_size = 512m

Expire_logs_days = 7

Key_buffer_size = 256MB

Read_buffer_size = 1m

Read_rnd_buffer_size = 16m

Bulk_insert_buffer_size = 64m

Skip-name-resolve

Lower_case_table_names = 1

Innodb_buffer_pool_size = 512m

Innodb_thread_concurrency = 8

Innodb_flush_log_at_trx_commit = 2

Innodb_log_buffer_size = 16m

Innodb_log_file_size = 128m

Innodb_log_files_in_group = 3

Innodb_max_dirty_pages_pct = 90

Innodb_lock_wait_timeout = 120

Innodb_file_per_table = on

[mysqldump]

Quick

Max_allowed_packet = 32m

[mysqld_safe]

Log-error=/data/3306/logs/mysql_ray.err

Pid-file=/data/3306/logs/ray.pid

/ usr/local/mysql/bin/mysqld_safe-- defaults-file=/data/3306/my.cnf 2 > & 1 > / dev/null &

/ usr/local/mysql/bin/mysql-uroot-puE70uYprtw?d-S / data/3306/soket/mysql.sock

Mysql > set password = password ('123456')

Mysql > flush privileges

Start the script:

[root@localhost ~] # vi / data/3306/mysqld

#! / bin/bash

Mysql_port=3306

Mysql_username= "root"

Mysql_password= "123456"

Function_start_mysql ()

{

Printf "Starting MySQL...\ n"

/ bin/sh / usr/local/mysql/bin/mysqld_safe-- defaults-file=/data/$ {mysql_port} / my.cnf 2 > & 1 > / dev/null &

}

Function_stop_mysql ()

{

Printf "Stoping MySQL...\ n"

/ usr/local/mysql/bin/mysqladmin-u ${mysql_username}-p$ {mysql_password}-S / data/$ {mysql_port} / soket/mysql.sock shutdown

}

Function_restart_mysql ()

{

Printf "Restarting MySQL...\ n"

Function_stop_mysql

Function_start_mysql

}

Function_kill_mysql ()

{

Kill-9 $(ps-ef | grep 'bin/mysqld_safe' | grep ${mysql_port} | awk' {printf $2}')

Kill-9 $(ps-ef | grep 'libexec/mysqld' | grep ${mysql_port} | awk' {printf $2}')

}

Case $1 in

Start)

Function_start_mysql

Stop)

Function_stop_mysql

Kill)

Function_kill_mysql

Restart)

Function_stop_mysql

Function_start_mysql

*)

Echo "Usage: / data/$ {mysql_port} / mysqld {start | stop | restart | kill}"

Esac

Example two

[root@localhost] # / usr/local/mysql/bin/mysqld-initialize-user=mysql-basedir=/usr/local/mysql/-datadir=/data/3307/data

2017-03-03T07:30:47.741108Z 1 [Note] A temporary password is generated for root@localhost: (+ 9QZ2l flush privileges

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report