1)rpm包安装MySQL数据库(安装MySQL-5.5.31版本)
unzip mysqlsetup.zip
Archive: mysqlsetup.zip
inflating: MySQL-devel-5.5.31-2.rhel5.x86_64.rpm
inflating: MySQL-server-5.5.31-2.rhel5.x86_64.rpm
inflating: MySQL-shared-5.5.31-2.rhel5.x86_64.rpm
inflating: MySQL-client-5.5.31-2.rhel5.x86_64.rpm
rpm -ivh MySQL-*
安装报如下错误:(有冲突)
error: Failed dependencies:
mysql-devel conflicts with MySQL-devel-5.5.31-2.rhel5.x86_64
MySQL-devel conflicts with mysql-devel-5.1.61-4.el6.x86_64
MySQL conflicts with mysql-5.1.61-4.el6.x86_64
卸载之前的安装包:
Rpm -qa | grep mysql | xargs rpm -e --nodeps
Rpm -ivh MySQL-* 成功
编辑配置文件:
vi /etc/my.cnf
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 2048M
max_allowed_packet = 512M
table_open_cache = 102400
sort_buffer_size = 1024M
read_buffer_size = 1024M
read_rnd_buffer_size = 1024M
myisam_sort_buffer_size = 2048M
thread_cache_size = 16
query_cache_size= 1024M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 16
lower_case_table_names=1
skip-name-resolve
character_set_server = gbk
max_connections=4000
datadir=/data/mysql
log-bin=mysql-bin
# binary logging format - mixed recommended
binlog_format=mixed
# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id = 1
[mysqldump]
quick
max_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 = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout