环境
CentOS 6.6 x_64
cos79 10.1.8.79 192.168.10.79
cos80 10.1.8.80 192.168.10.80
10.1.8.89 cos89
10.1.8.90 cos90
mysql-5.6.25
安装MySQL Server
编译安装
cd;rm -rf mysql-5.6.25;
tar -zxf mysql-5.6.25.tar.gz;cd mysql-5.6.25;
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
make && make install
mv /etc/my.cnf /etc/my.cnf.BAK;mkdir -p /usr/local/mysql/log;chown -R mysql:mysql /usr/local/mysql
cd /usr/local/mysql;scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
echo "tmp_table_size=2048M
max_heap_table_size=2048M
log_error=/usr/local/mysql/log/error_log.log
general_log=OFF
general_log_file=/usr/local/mysql/log/general.log
max_connections = 768
max_connect_errors = 500
skip-name-resolve">>/usr/local/mysql/my.cnf
echo -e 'export PATH=/usr/local/mysql/bin:$PATH'>>~/.bash_profile;source ~/.bash_profile
cp support-files/mysql.server /etc/init.d/mysql;chmod +x /etc/init.d/mysql
chkconfig mysqld off;chkconfig --del mysqld;mv /etc/init.d/mysqld /etc/init.d/mysqld.BAK;chkconfig --add mysql;chkconfig mysql on
service mysql restart
异常处理
如果编译报错
CMake Error at cmake/readline.cmake:85 (MESSAGE):
Curses library not found. Please install appropriate package,
remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.
Call Stack (most recent call first):
cmake/readline.cmake:128 (FIND_CURSES)
cmake/readline.cmake:202 (MYSQL_USE_BUNDLED_EDITLINE)
CMakeLists.txt:409 (MYSQL_CHECK_EDITLINE)
解决办法
yum install -y ncurses-devel.x86_64;make clean;rm -rf CMakeCache.txt
配置选项
远程登录
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '000000' WITH GRANT OPTION;
FLUSH PRIVILEGES;
重置登录失败次数
mysqladmin flush-hosts -uroot -p
视情况需要链接so
ln -s /usr/local/mysql/lib/libmysqlclient.so /usr/lib/libmysqlclient.so
ln -s /usr/local/mysql/lib/libmysqlclient.so /usr/lib64/libmysqlclient.so
ln -s /usr/local/mysql/lib/libmysqlclient.so /usr/lib/libmysqlclient.so.18
ln -s /usr/local/mysql/lib/libmysqlclient.so /usr/lib64/libmysqlclient.so.18
-EOF-