Centos7软件安装系列【十四】安装mysql-5.7.13
#安装cd /home/softwaretar xzvf mysql-boost-5.7.13.tar.gzmkdir -p /usr/local/mysql/datacd mysql-5.7.13cmake \-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock...
·
#安装
cd /home/software
tar xzvf mysql-boost-5.7.13.tar.gz
mkdir -p /usr/local/mysql/data
cd mysql-5.7.13
cmake \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT=3306 \
-DENABLE_DOWNLOADS=1 \
-DDOWNLOAD_BOOST=1 \
-DWITH_BOOST=/home/software/mysql-5.7.13/boost/
-DWITH_EMBEDDED_SERVER=OFF
make
make install
#安装killall
yum install psmisc
groupadd mysql
useradd -g mysql mysql
chmod +w /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql
chmod -R 777 /usr/local/mysql
cp support-files/my-default.cnf /usr/local/mysql/my.cnf
mkdir -p /usr/local/mysql/log
#[mysqld]
echo "basedir = /usr/local/mysql" >> /usr/local/mysql/my.cnf
echo "datadir=/usr/local/mysql/data" >> /usr/local/mysql/my.cnf
echo "socket=/usr/local/mysql/mysql.sock" >> /usr/local/mysql/my.cnf
echo "port = 3306" >> /usr/local/mysql/my.cnf
#user=mysql
echo "symbolic-links=0" >> /usr/local/mysql/my.cnf
#echo "skip-grant-tables=1" >> /usr/local/mysql/my.cnf
echo "[mysqld_safe]" >> /usr/local/mysql/my.cnf
echo "log-error=/usr/local/mysql/log/mysqld.log" >> /usr/local/mysql/my.cnf
echo "pid-file=/usr/local/mysql/mysqld.pid" >> /usr/local/mysql/my.cnf
sed -i 's/^sql_mode=.*$/sql_mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION/g' /usr/local/mysql/my.cnf
echo "export MYSQL_PATH=/usr/local/mysql" >> /etc/profile
echo "export PATH=\$PATH:\$MYSQL_PATH/bin" >> /etc/profile
source /etc/profile
cd /usr/local/mysql
bin/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
bin/mysqld_safe --defaults-file=/usr/local/mysql/my.cnf --user=mysql --skip-grant-tables &
mysql -uroot -p -e "
use mysql;
update user set authentication_string=PASSWORD('111111') where user='root';
flush privileges;
quit"
killall mysqld_safe
killall mysqld
sleep 5
bin/mysqld_safe --defaults-file=/usr/local/mysql/my.cnf &
cd /home/software/mysql-5.7.13/
cp support-files/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
killall mysqld_safe
killall mysqld
sleep 5
service mysql restart
#把mysql注册为开机启动的服务
chkconfig --add mysql
#开启防火墙
firewall-cmd --permanent --zone=public --add-port=3306/tcp
firewall-cmd --reload
#初始化密码,设置权限
alter user 'root'@'localhost' identified by '111111';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.233.1' IDENTIFIED BY '111111';
更多推荐
已为社区贡献3条内容
所有评论(0)