ubuntu 12 安装 MySQL 5.7

sudo apt-get update
sudo apt-get upgrade
apt-get install libaio1
(apt-get install mysql-server mysql-client自动安装会装上5.5)

sudo groupadd mysql
sudo useradd -r -g mysql mysql


cd /usr/local/src
sudo wget  mysql-server_5.7.6-m16-1ubuntu12.04_amd64.deb-bundle.tar http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-server_5.7.6-m16-1ubuntu12.04_amd64.deb-bundle.tar

sudo tar -xvf mysql-server_5.7.6-m16-1ubuntu12.04_amd64.deb-bundle.tar
sudo dpkg -i mysql-common_5.7.6-m16-1ubuntu12.04_amd64.deb
sudo dpkg-preconfigure mysql-community-server_5.7.6-m16-1ubuntu12.04_amd64.deb

这一步骤会提示让你输入root密码,后期可改,随便输个。

sudo apt-get -f install

sudo dpkg -i mysql-community-server_5.7.6-m16-1ubuntu12.04_amd64.deb
sudo dpkg -i mysql-community-client_5.7.6-m16-1ubuntu12.04_amd64.deb
sudo dpkg -i libmysqlclient20_5.7.6-m16-1ubuntu12.04_amd64.deb


cd /usr/local/
sudo ln -s /var/lib/mysql  /usr/local/mysql
sudo mkdir /usr/local/mysql/data
sudo chown -R mysql. /usr/local/mysql/data



修改密码 
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,说明配置已生效

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。