CentOS 6 源码编译安装mysql-5.6.26

1、安装必要软件

yum install –y gcc gcc-c++ gcc-lib ncurses-devel

2、解压

tar xf mysql-5.6.26.tar.gz

3、编译

cd mysql-5.6.26

cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DSYSCONFDIR=/usr/local/mysql \
-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 –j # #最大可为CPU核心数的2倍

make install

4、修改配置文件,配置文件放置/usr/local/myslql目录下,配置文件如下,根据具体情况修改

5、创建用户 ,修改所属关系

groupadd mysql

useradd -g mysql mysql -s /bin/false

6、初始化mysql

cd /usr/loca/mysql/scripts

./mysql_install_db –datadir=/usr/local/mysql/data –user=mysql –basedir=/usr/local/mysql

7、规划启动脚本,

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

chkconfig mysqld on

8、启动服务,构建数据库账户信息

grant all privileges on *.* ‘root’@’192.168.%.%’ identified by ‘123456’;

create database DATABASE_NAME;

删除行

delete from DB_name.tb_name where *=x ;

发表评论