首页 > 代码库 > Cent OS 7 编译安装 My SQL 5.7
Cent OS 7 编译安装 My SQL 5.7
yum -y groupinstall "Development tools"
yum -y install ncurses-devel pcre-devel openssl-devel bison
cd /opt
wget https://nchc.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.gz
tar -zxf boost_1_59_0.tar.gz
备注:boost是免费的第三方c++库。
wget https://cmake.org/files/v3.7/cmake-3.7.1.tar.gz
tar -zxf cmake-3.7.1.tar.gz
cd cmake-3.7.1
./bootstrap
make
make install
cmake --version
groupadd -r mysql
useradd -r -M -g mysql -s /sbin/nologin mysql
mkdir -pv /data/mysql
chown -R mysql:mysql /data/mysql
ll -d /data/mysql
tar -zxf mysql-5.7.10.tar.gz
cd mysql-5.7.10/
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DSYSCONFDIR=/etc -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_ARCHIVE_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DENABLE_DOWNLOADS=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 -DDOWNLOAD_BOOST=1 -DWITH_BOOST=/opt/boost_1_59_0 -DWITH_FEDERATED_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_LIBWRAP=0 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
make
make install
echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
source /etc/profile
mysqld --initialize --user=mysql --datadir=/data/mysql --basedir=/usr/local/mysql#数据库的初始化,注意root的初始密码
cd /usr/local/mysql/support-files/
cp mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
service mysqld start
service mysqld stop
mysqld_safe --skip-grant-tables &#以忽略授权表的方式重启数据库,设置root密码
mysql> update mysql.user set authentication_string=password(‘abc-123.‘) where user=‘root‘ and Host=‘localhost‘;#密码必须在8位以上
mysql> flush privileges;
service mysqld restart
关于报错:
1)You must reset your password using ALTER USER statement before executing this statement.由于密码设置过于简单导致的问题。
解决:
mysql> SET PASSWORD = PASSWORD(‘abc-123.‘);
mysql> ALTER USER ‘root‘@‘localhost‘ PASSWORD EXPIRE NEVER;
mysql> flush privileges;
本文出自 “一万年太久,只争朝夕” 博客,请务必保留此出处http://zengwj1949.blog.51cto.com/10747365/1937350
Cent OS 7 编译安装 My SQL 5.7