安装依赖包
yum install -y centos-release-scl devtoolset-4-gcc-c++ devtoolset-4-gcc cmake openssl-devel bison git gmock ncurses ncurses-* autoconf
创建账号
groupadd mysql && useradd -r -g mysql mysql
wget http://mirror.cnop.net/alisql/AliSQL-5.6.32.zip && unzip AliSQL-5.6.32.zip && cd AliSQL-master
scl enable devtoolset-4 bash
mkdir source_downloads && cd source_downloads && wget http://mirror.cnop.net/gmock/gmock-1.6.0.zip && cd ..
编译:
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/alisql \
-DMYSQL_UNIX_ADDR=/usr/local/alisql/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/usr/local/alisql/data \
-DMYSQL_TCP_PORT=3306 \
-DENABLE_DOWNLOADS=1
安装:
make
make install
chown -R mysql.mysql /usr/local/alisql/
echo never > /sys/kernel/mm/transparent_hugepage/enabled
初始化数据:
chmod +x ./scripts/mysql_install_db
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/alisql --datadir=/usr/local/alisql/data
vi /etc/my.cnf #加入以下内容
[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
port = 3306
socket = /tmp/mysql.sock
datadir = /usr/local/alisql/data
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 10M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
thread_cache_size = 8
query_cache_size = 8M
tmp_table_size = 16M
max_connections = 500
max_connect_errors = 100
open_files_limit = 65535
log-bin=mysql-bin
binlog_format=mixed
server-id = 1
expire_logs_days = 10
default_storage_engine = InnoDB
innodb_file_per_table = 1
innodb_data_home_dir = /usr/local/alisql/data
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /usr/local/alisql/data
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
拷贝启动项:
cp support-files/mysql.server /etc/init.d/mysqld
环境变量配置:
vi /etc/profile #加入以下
PATH=/usr/local/alisql/bin:/usr/local/alisql/lib:$PATH
export PATH
source /etc/profile
软链接:
ln -s /usr/local/alisql/bin/mysql /usr/bin
启动并设置开机启动:
chmod +x /etc/init.d/mysqld
service mysqld start
chkconfig --level 35 mysqld on
查看是否启动:
netstat -tulnp | grep 3306
mysql -u root -p #默认root密码为空
#授权新密码
mysqladmin -uroot -p password 123456
#运行后按提示输入一次确定密码即可(这里是123456)
mysql -uroot -p #重新登录
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。