centos 7 源代码安装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 setup
shell> groupadd mysql
shell> useradd -r -g mysql -s /bin/false mysql

# Beginning of source-build specific instructions
shell> tar xvf mysql-5.6.16.tar.gz
shell> cd mysql-5.6.16
shell> mkdir bld
shell> cd bld
shell> cmake ..
若出错
make clean
rm -f CMakeCache.txt
看到最后输出:Build files have been written to:xxxxxxx证明编译成功


shell> make
shell> make install
# End of source-build specific instructions

# Postinstallation setup
shell> cd /usr/local/mysql
shell> chown -R mysql:mysql .

# Create the MySQL Server grant tables
shell> scripts/mysql_install_db --user=mysql

# Change back the owner and group of /usr/local/mysql/ directory and it’s contents to root
shell> chown -R root .
# Change the owner of /usr/local/mysql/ directory to mysql.
shell> 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.
shell> chmod -R go-rwx data

# Setting the configuration file
shell> 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 shown
below.
user = mysql
character-set-server = utf8

# Initializing the MySQL Server grant tables.
shell> bin/mysqld_safe --user=mysql &

# Setting the MySQL Server service
shell> cp -v support-files/mysql.server /etc/init.d/mysql

# Add mysql as a Sys V init service.
shell> chkconfig --add mysql

# start the mysql service
shell> 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/bin
export PATH

 


select user,host,password from mysql.user;
set 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

posted @ 2019-02-16 15:44  白開水  阅读(297)  评论(0编辑  收藏  举报