centos7源代码安装mysql5.6
###### mysql #########
引言:这里选用mysql5.6版本,5.7版本编译时间需要几个小时。
编译安装环境:
yum -y install make gcc-c++ cmake bison-devel ncurses-devel gcc\
autoconf automake zlib* fiex* libxml* libmcrypt* libtool-ltdl-devel*
下载mysql5.6
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.16.tar.gz
# Preconfiguration setu
hell> groupadd mysql
hell> useradd -r -g mysql -s /bin/false mysql
# Beginning of source-build specific instructio
hell> tar xvf mysql-5.6.16.tar.gz
hell> cd mysql-5.6.16
hell> mkdir bld
hell> cd bld
hell> cmake ..
若出错
make clea
rm -f CMakeCache.txt
看到最后输出:Build files have been written to:xxxxxxx证明编译成功
hell> make
hell> make install
# End of source-build specific instructio
# Postinstallation setu
hell> cd /usr/local/mysql
hell> chown -R mysql:mysql .
# Create the MySQL Server grant table
hell> scripts/mysql_install_db --user=mysql
# Change back the owner and group of /usr/local/mysql/ directory and it’s contents to root
hell> chown -R root .
# Change the owner of /usr/local/mysql/ directory to mysql.
hell> chown -R mysql data
# Remove the permissions for group and others on /usr/local/mysql/data/ directory. So that only
mysql will have access to it.
hell> chmod -R go-rwx data
# Setting the configuration file
hell> cp support-files/my-default.cnf /etc/my.cnf
# set MySQL Server to run as the standard user mysql,[mysqld] section add a new line as show
elow.
user = mysql
character-set-server = utf8
# Initializing the MySQL Server grant tables.
hell> bin/mysqld_safe --user=mysql &am
# Setting the MySQL Server service
hell> cp -v support-files/mysql.server /etc/init.d/mysql
# Add mysql as a Sys V init service.
hell> chkconfig --add mysql
# start the mysql service
hell> service mysql start
# $PATH
vim /etc/profile
PATH=
$PATH:/usr/local/php71/bin:/usr/local/php71/sbin:/usr/local/apache24/bin:/usr/local/nginx/sbin:
/usr/local/redis4/bin:/usr/local/mysql/bi
export PATH
elect user,host,password from mysql.user
et password = password('root')
delete from mysql.user where password=''
问题: bash: service: command not found yum install initscripts -y
参考文档:
http://howtolamp.com/lamp/mysql/5.6/installing/
https://itbilu.com/database/mysql/VJVOut01M.html
https://www.linuxidc.com/Linux/2017-10/148100.htm
https://www.helloweba.net/server/514.html