cmake软件
tar -zxvf cmake-2.8.11.2.tar.gz
cd cmake-2.8.11.2
./bootstrap
make
make install
cd ../
依赖包
yum install ncurses-devel -y
yum install pcre pcre-devel -y
yum install gcc* -y
创建用户
groupadd mysql
useradd -g mysql mysql
echo "oracle" |passwd --stdin mysql
创建目录
mkdir mkdir /data/mysql/{data,tmp} -p
chown -R mysql:mysql /data
解压编译MySQL
tar -zxvf mysql-5.6.31.tar.gz
cd mysql-5.6.31
cmake . -DCMAKE_INSTALL_PREFIX=/data/mysql -DMYSQL_DATADIR=/data/mysql/data -DMYSQL_UNIX_ADDR=/data/mysql/tmp/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STPRAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DWIYH_READLINE=1 -DWIYH_SSL=system -DVITH_ZLIB=system -DWITH_LOBWRAP=0 -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
make
#[100%] Built target my_safe_process
make install
如果上述操作未出现错误,则MySQL 软件cmake方式的安装就算成功了。
添加/data/mysql/bin到环境变量
export PATH=/data/mysql/bin:$PATH
source /etc/profile
初始化数据库
/data/mysql/scripts/mysql_install_db --basedir=/data/mysql --datadir=/data/mysql/data/ --user=mysql
添加到chkconfig能管理的服务
cp /data/mysql/support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
然后就可以使用此命令启动/关闭 mysql:
/etc/init.d/mysqld start
/etc/init.d/mysqld stop
设置密码:
/data/mysql/bin/mysqladmin -u root password "oracle"
删除一些用户
delete from mysql.user where user!='root' or host!='localhost';
创建管理员用户
create user admin IDENTIFIED by 'chain#3360DRGP';
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
创建数据库:
CREATE DATABASE dwdb DEFAULT CHARACTER SET utf8;