您好,登录后才能下订单哦!
编译前安装准备
OS:CentOS 6.9
Mysql:5.7.18
下载Mysql源
官网源:mysql-boost mysql
搜狐源:mysql-boost mysql
安装Mysql之前卸载原有的版本
查询Mysql目录文件 卸载原有MySQL
# rpm -qa | grep mysql
# find / -name mysql
# yum remove -y mysql-libs-5.1.73-3.el6_5.x86_64
安装编译环境
# yum -y install make wget gcc-c++ cmake bison-devel ncurses-devel
Preconfiguration setup
# groupadd mysql
# useradd -r -g mysql -s /bin/false mysql
Beginning of source-build specific instructions
# mkdir ~/mysql && cd ~/mysql
# mkdir -p /data/mysql_data
# wget -c https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-boost-5.7.18.tar.gz
# tar -zxvf mysql-boost-5.7.18.tar.gz && cd mysql-5.7.18/
# cmake . \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/data/mysql_data \
-DSYSCONFDIR=/etc \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=/usr/local/boost \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
# make
# make install
End of source-build specific instructions
Postinstallation setup
# cd /usr/local/mysql
# chown -R mysql .
# chgrp -R mysql .
Before MySQL 5.7.6
# bin/mysql_install_db --user=mysql
MySQL 5.7.6 and up
# bin/mysqld --initialize --user=mysql
# bin/mysql_ssl_rsa_setup
# chown -R root .
# chown -R mysql /data
# bin/mysqld_safe --user=mysql &
配置开机启动项
# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql.server
# chmod +x /etc/init.d/mysql.server
# chkconfig --add mysql.server
# chkconfig mysql.server on
配置/etc/my.cnf 仅供参考,可以不配用默认的。
启动mysql
# service mysql.server start
加入开机启动项
# chkconfig --live 35 mysql.server on
查看端口是否被占用
# netstat -tulnp | grep 3306
查看数据库版本
# ln -s /usr/local/mysql/bin/mysql /usr/bin/
# mysql --version
登入数据库
# mysql -u root -p
查看数据库
>show databases;
重设密码,这里密码设置为?root?
>set password = password('?root?');
退出数据库
>exit;
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。