ubuntu安装mysql5.7

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install mysql-server mysql-client   #自动安装会装上5.7的client端,中间会弹出提示框输入root的密码

sudo groupadd mysql
sudo useradd -r -g mysql mysql


修改密码 
sudo /usr/bin/mysqladmin -u root password

登录
sudo /usr/bin/mysql -u root -p [可选数据库名称]

远程连接

GRANT ALL PRIVILEGES ON *.* TO 'root'@'10.10.40.54' IDENTIFIED BY '123456' WITH GRANT OPTION;

远程连接某表 : 创建
username用户,可远程访问app数据库下user表,具有读、更新权限

grant select,update on app.user to username@‘%’ identified by '123456'; 

open_files_limit = 10240
back_log = 258
max_connections = 5000
max_connect_errors = 716
external-locking = FALSE
max_allowed_packet = 32M
sort_buffer_size = 8M
join_buffer_size = 1M
thread_cache_size = 300
query_cache_type=1
query_cache_size = 512M
query_cache_limit = 2M
query_cache_min_res_unit = 2k
thread_stack = 192K
tmp_table_size = 258M
max_heap_table_size = 258M
key_buffer_size = 512M
read_buffer_size = 4M
read_rnd_buffer_size = 16M
wait_timeout=1814400
bulk_insert_buffer_size = 64M
innodb_buffer_pool_size = 8000M
innodb_buffer_pool_instances=32
innodb_thread_concurrency = 8
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 16M
innodb_log_file_size = 2048M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
innodb_read_io_threads = 16
innodb_write_io_threads = 16
innodb_io_capacity = 20000
innodb_io_capacity_max = 40000

查看连接数

show variables like '%max_connections%'
这时应该为5000,说明配置已生效

原文地址:https://www.cnblogs.com/duanxz/p/5530152.html