CentOS7.2安装mysql5.5.39
mkdir /home/mysql
将mysql5.5.39和cmake2.8.3的包传到/home/mysql下
cmake安装
yum -y install ncurses ncurses-devel openssl-devel bison gcc gcc-c++ make
cd cmake-2.8.3.tar.gz
./bootstrap --prefix=/home/mysql/tools/cmake
make
make install
mysql安装
tar -zxvf mysql-5.5.39.tar.gz
vim /etc/profile
在最后加上一行配置环境变量export PATH=$PATH:/home/mysql/tools/cmake/bin
source /etc/profile
cd mysql-5.5.39/
bpath=/home/mysql/mysql
port=3306
yum -y install cmake
cmake . \
-DCMAKE_INSTALL_PREFIX=${bpath} \
-DSYSCONFDIR=${bpath}/etc \
-DMYSQL_DATADIR=${bpath}/var \
-DINSTALL_MYSQLDATADIR=${bpath}/var \
-DMYSQL_TCP_PORT=$port \
-DDEFAULT_CHARSET=utf8 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_COLLATION=utf8_general_ci \
-DMYSQL_UNIX_ADDR=${bpath}/tmp/mysql.sock \
-DWITH_INNOBASE_STORAGE_ENGINE=1
make
make install
cd /home/mysql/mysql
mkdir etc
mkdir log
mkdir tmp
mkdir var
vim etc/my.cnf
[client]
port = 3306
socket = /home/mysql/mysql/tmp/mysql.sock
[mysqld]
server-id = 18009
!include /home/mysql/mysql/etc/mysqld.cnf
port = 3306
basedir = /home/mysql/mysql/
socket = /home/mysql/mysql/tmp/mysql.sock
pid-file = /home/mysql/mysql/var/mysql.pid
datadir = /home/mysql/mysql/var/
tmpdir = /home/mysql/mysql/tmp/
slave-load-tmpdir = /home/mysql/mysql/tmp/
# skip lever
skip-name-resolve
skip-symbolic-links
skip-external-locking
skip-slave-start
#thread level
table_open_cache = 2048
#############connect############
back_log = 50
max_connections = 1000
max_connect_errors = 10000
#open_files_limit = 10240
##############timeout###########
connect-timeout = 10
wait-timeout = 800
interactive-timeout = 800
slave-net-timeout = 60
net_read_timeout = 30
net_write_timeout = 60
net_retry_count = 10
net_buffer_length = 16384
max_allowed_packet = 64M
################# cache #############
table_cache = 2048
thread_stack = 192K
thread_cache_size = 100
thread_concurrency = 16
# qcache settings
query_cache_size = 256M
query_cache_limit = 2M
query_cache_min_res_unit = 2K
# default settings
# time zone
default-time-zone = system
character-set-server = utf8
default-storage-engine = InnoDB
# tmp & heap
tmp_table_size = 512M
max_heap_table_size = 512M
log-bin = mysql-bin
log-bin-index = mysql-bin.index
relay-log = relay-log
relay_log_index = relay-log.index
# warning & error log
log-warnings = 1
log-error = /home/mysql/mysql/log/mysql.err
log-output = FILE
# slow query log
slow_query_log = 1
long-query-time = 1
slow_query_log_file = /home/mysql/mysql/log/slow.log
#log-queries-not-using-indexes
#log-slow-slave-statements
general_log = 0
general_log_file = /home/mysql/mysql/log/mysql.log
max_binlog_size = 1G
max_relay_log_size = 1G
# if use auto-ex, set to 0
relay-log-purge = 1
# max binlog keeps days
expire_logs_days = 7
binlog_cache_size = 1M
# replication
replicate-wild-ignore-table = mysql.%
replicate-wild-ignore-table = test.%
# slave_skip_errors=all
key_buffer_size = 256M
sort_buffer_size = 2M
read_buffer_size = 2M
join_buffer_size = 8M
read_rnd_buffer_size = 8M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 64M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover
group_concat_max_len = 64K
transaction_isolation = REPEATABLE-READ
innodb_file_per_table
#rning & error log
log-warnings = 1
log-error = /home/mysql/mysql/log/mysql.err
log-output = FILE
# slow query log
slow_query_log = 1
long-query-time = 1
slow_query_log_file = /home/mysql/mysql/log/slow.log
#log-queries-not-using-indexes
#log-slow-slave-statements
general_log = 1
general_log_file = /home/mysql/mysql/log/mysql.log
max_binlog_size = 1G
max_relay_log_size = 1G
# if use auto-ex, set to 0
relay-log-purge = 1
# max binlog keeps days
expire_logs_days = 7
############mysql5.5new################
innodb_file_format = Barracuda
########################################
innodb_additional_mem_pool_size = 100M
innodb_buffer_pool_size = 400M
innodb_data_home_dir = /home/mysql/mysql/var/
innodb_data_file_path = ibdata1:1G:autoextend
################mysql5.5new############
innodb_read_io_threads = 8
innodb_write_io_threads = 8
innodb_purge_threads = 1
########################################
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 16M
innodb_log_file_size = 400M
innodb_log_files_in_group = 2
innodb_log_group_home_dir = /home/mysql/mysql/var/
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 50
#innodb_flush_method = O_DSYNC
################mysql5.5 new#####################
innodb_buffer_pool_instances = 16
innodb_change_buffering = all
innodb_adaptive_flushing = 1
innodb_io_capacity = 2000
innodb_old_blocks_time = 1000
innodb_stats_on_metadata = 0
#################################################
old-passwords = 0
[mysqldump]
quick
max_allowed_packet = 64M
[mysql]
no-auto-rehash
default-character-set = utf8
connect-timeout = 3
[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
cp scripts/mysql_install_db ./bin/
./bin/mysql_install_db --defaults-file=${bpath}/etc/my.cnf
cp support-files/mysql.server ./bin/
mkdir /var/lib/mysql
ln -s /home/mysql/mysql/tmp/mysql.sock /var/lib/mysql/mysql.sock
groupadd mysql
useradd -r -g mysql mysql
chown mysql.mysql -R /home/mysql/mysql
./bin/mysql.server start
mysqladmin -uroot password '123456'
mysql -uroot -p123456
要想让navicat连接mysql则需要执行下面两句
grant all privileges on *.* to root@'%' identified by "123456"; //”123456”为数据库密码
flush privileges;
如果需要用户和权限跟麒麟官网的一致则需要把官网的mysql库替换到新的数据库上。
the server quit without updating pidfile解决方法。如果还不行就是受/etc/my.cnf影响,删除就好了。
[root@localhost mysql]# ./scripts/mysql_install_db --user=mysqlInstalling MySQL system tables...OKFilling help tables...OKTo start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands:./bin/mysqladmin -u root password 'new-password'./bin/mysqladmin -u root -h localhost.localdomain password 'new-password'Alternatively you can run:./bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default. This isstrongly recommended for production servers.See the manual for more instructions.You can start the MySQL daemon with:cd . ; ./bin/mysqld_safe &You can test the MySQL daemon with mysql-test-run.plcd ./mysql-test ; perl mysql-test-run.plPlease report any problems with the ./bin/mysqlbug script![root@localhost mysql]#

浙公网安备 33010602011771号