centos7部署两个mysql_centos7.2 环境下 mysql-5.1.73 安装配置

安装mysql,安装前准备

如果mysql用户不存在,那么添加mysql用户

groupadd mysql

useradd -g mysql mysql

mysql编译安装

tar -zxvf mysql-5.1.73.tar.gz

cd mysql-5.1.73

yum install ncurses ncurses-devel

./configure ‘--prefix=/usr/local/mysql‘ ‘--without-debug‘ ‘--with-charset=utf8‘ ‘--with-extra-charsets=all‘ ‘--enable-assembler‘ ‘--with-pthread‘ ‘--enable-thread-safe-client‘ ‘--with-mysqld-ldflags=-all-static‘ ‘--with-client-ldflags=-all-static‘ ‘--with-big-tables‘ ‘--with-readline‘ ‘--with-ssl‘ ‘--with-embedded-server‘ ‘--enable-local-infile‘ ‘--with-plugins=innobase‘

make

make install

到此mysql就安装到了/usr/local/mysql路径下,下面开始mysql的配置工作

安装mysql选项文件

cp support-files/my-medium.cnf /etc/my.cnf

cp -r support-files/mysql.server /etc/init.d/mysqld

/sbin/chkconfig --del mysqld

/sbin/chkconfig --add mysqld

配置权限表

chown -R mysql:mysql /usr/local/mysql

/usr/local/mysql/bin/mysql_install_db --user=mysql

启动mysql

给/etc/init.d/mysql 执行权限,然后运行

chmod a+wrx /etc/init.d/mysql

/etc/init.d/mysqld start

mysql初始化配置:

包括密码设置等

export PATH=/usr/local/mysql/bin:$PATH

/usr/local/mysql/bin/mysql_secure_installation

在弹出的对话框中要求输入密码:

Enter current password for root (enter for none):

默认打回车,然后重新设置root密码:

Set root password? [Y/n] y

Disallow root login remotely? [Y/n] n

Remove test database and access to it? [Y/n] n

Reload privilege tables now? [Y/n] y

至此,Mysql运行成功

原文:https://www.cnblogs.com/lixinliang/p/10052294.html

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值