@Great-Chinese
2016-10-12T08:03:02.000000Z
字数 2171
阅读 857
Mysql
去 http://mirrors.sohu.com/mysql/ 现在需要的Mysql版本 例如: mysql-5.5.51.tar.gz
yum install -y cmake ncurses-devel gcc gcc-c++ ncurses libaio bison
mkdir /data/mysqlgroupadd mysqluseradd -g mysql mysql
tar -xvf mysql-5.5.51.tar.gz
time cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql5 -DMYSQL_DATADIR=/data/mysql5 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_UNIX_ADDR==/usr/local/mysql5/mysql.sock -DMYSQL_USER=mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_C# 编译安装make && make install
[client]port = 3311socket = /data/mysql5/mysql.sock# The MySQL server[mysqld]datadir = /data/mysql5port = 3311socket = /data/mysql5/mysql.socket# 设置分配给数据库内存的50-70%innodb_buffer_pool_size=1024M# mysql使用独立表空间innodb_file_per_table=1innodb_log_files_in_group=2# mysql数据文件大小,设置为1Ginnodb_data_file_path=ibdata1:1G:autoextend# 日志文件大小设置为512Minnodb_log_file_size=512M#记录数据库全部操作,不建议开启。影响数据库5%的性能general_log=0# 日志操作记录文件general_log_file=/data/mysql5/local01.log# 开启慢日志查询slow_query_log = 1# 执行时长超过1S的SQL语句昨晚慢日志long_query_time = 1# 记录没有使用索引的查询,不建议开启,开启后分析慢日志不方便log_queries_not_using_indexes=0# 设置mysql最大连接数max_connection=3000#max_connection_error=100000# 文件打开数量 为max_connection的10倍open_files_limit=30000innodb_open_files=30000table_open_cache=30000table_definition_cache=3000# 这个要尽量的小key_buffer_size=32M#禁用查询缓存query_cache_type=0#查询缓存大小为0Mquery_cache_size=0# 设置数据库默认引擎default-storage-engine=INNODB# bin log 配置max_binlog_size=67108864 # 配置binlog_cache_size=1048576[mysqldump]quickmax_allowed_packet = 16M[mysql]no-auto-rehash# Remove the next comment character if you are not familiar with SQL#safe-updates[myisamchk]key_buffer_size = 128Msort_buffer_size = 128Mread_buffer = 2Mwrite_buffer = 2M[mysqlhotcopy]interactive-timeout
./scripts/mysql_install_db --user=mysql --datadir=/data/mysql5
cp support-files/mysql.server /etc/init.d/mysqld5# 打开文件/etc/init.d/mysqld5 设置datadir 和basedir# centos6 启动Mysqlchkconfig add mysqld5service mysqld5 start# centos7 启动Mysqlsystemctl enable mysqld5systemctl start mysqld5
#查看当前数据库的字符集SHOW VARIABLES LIKE '%character%'# 命令行查看当前数据库的字符集status# 查看当前数据库支持的字符集SHOW CHARACTER SET