centos7下源码安装mysql5.6_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

# 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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值