centos6.5安装mysql

版本:Mysql 5.6.38
1、 安装cmake
# tar xzvf cmake-2.8.8.tar.gz
# cd cmake-2.8.8
# ./configure
# gmake
# gmake install

2、安装 curses-devel gcc
# yum -y install curses-devel gcc

3、创建用户、组
# useradd -s /sbin/nologin mysql
# groupadd mysql

4、上传、解压mysql包
rz mysql-5.6.38.tar.gz
tar -ef mysql-5.6.38.tar.gz

5、cmake编译和安装
# cmake . -DCMAKE_INSTALL_PREFIX=/data/server/mysql \
-DMYSQL_DATADIR=/data/www/DB \
-DMYSQL_UNIX_ADDR=/data/www/DB/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii \
-DENABLED_LOCAL_INFILE=ON \    
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
-DWITHOUT_PARTITION_STORAGE_ENGINE=0 \
-DWITH_FAST_MUTEXES=1 \
-DWITH_ZLIB=bundled \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_READLINE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DWITH_DEBUG=0
# make && make install 
6、添加环境变量
# vim /etc/profile
export PATH=/application/mysql/bin:/application/mysql/scripts:$PATH
将这句话加到/etc/profile文本最后
sourse /etc/profile

7、拷贝配置文件且修改/etc/my.cnf
# cd /data/server/mysql/
# cp support-files/my-default.cnf /etc/my.cnf
# vim /etc/my.cnf
[mysqld]
basedir=/data/server/mysql
datadir=/data/www/DB
socket=/data/www/DB/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysql/mysqld.log
pid-file=/data/server/mysql/mysqld.pid

[extend]
skip-name-resolve
default-storage-engine=MYISAM
default-tmp-storage-engine=MYISAM
slow_query_log=on
slow_query_log_file=/tmp/slowquery.log
long_query_time=1

8、初始化数据库
# ./scripts/mysql_install_db --user=mysql --basedir=/data/server/mysql
 --datadir=/data/www/DB

9、设置自启动
chkconfig --level 35 mysqld on

10、启动数据库
# cp support-files/mysql.server /etc/init.d/mysqld
# chmod +x /etc/init.d/mysqld
# chown -R mysql:mysql /data/server/mysql/


如编译出错,则删除包下的CMakeCache.txt

 

posted @ 2018-04-25 08:35  想翻身的猫  阅读(209)  评论(0编辑  收藏  举报