广告
返回顶部
首页 > 资讯 > 数据库 >MySQL5.7单实例安装及开机启动配置(亲测)
  • 892
分享到

MySQL5.7单实例安装及开机启动配置(亲测)

MySQL5.7单实例安装及开机启动配置(亲测) 2014-10-07 23:10:48 892人浏览 猪猪侠
摘要

安装环境: Centos版本:CentOS7.6.1810 Mysql版本:5.7.9 软件目录:/soft cp /soft/mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz /usr/local/

MySQL5.7单实例安装及开机启动配置(亲测)

安装环境:

Centos版本:CentOS7.6.1810
Mysql版本:5.7.9

软件目录:/soft

cp /soft/mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz /usr/local/

解压mysql到/usr/local目录

tar -zxvf mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz

安装需要的依赖

yum install -y libaio

具体安装:

shell> groupadd mysql
shell> useradd -r -g mysql mysql
shell> cd /usr/local
shell> tar zxvf /path/to/mysql-VERSION-OS.tar.gz
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> mkdir mysql-files
shell> chmod 770 mysql-files
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> bin/mysqld --initialize --user=mysql     # MySQL 5.7.6 and up
shell> bin/mysql_ssl_rsa_setup              # MySQL 5.7.6 and up
shell> chown -R root .
shell> chown -R mysql data mysql-files
shell> bin/mysqld_safe --user=mysql &
# Next command is optional
shell> cp support-files/mysql.server /etc/init.d/mysql.server

配置环境变量:

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

配置开启启动

chkconfig mysql.server on
chkconfig --list

登陆,修改密码

set passWord = ‘root1234%’;

允许远程登陆

GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ IDENTIFIED BY ‘root1234%’

GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ IDENTIFIED BY ‘root1234%’ WITH GRANT OPTION;

flush privileges;

启动的时候可能会报错

这是因为mysql启动的时候需要配置文件,而在安装centos的时候,哪怕是mini版本都会有个默认的配置在/etc目录中。

/usr/local/mysql/bin/mysqld --verbose --help |grep -A 1 ‘Default options’
Default options are read from the following files in the given order:
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf ~/.my.cnf

Mysql启动的时候会以上面所述的顺序加载配置文件

如果报错,先重命名my.cnf文件

您可能感兴趣的文档:

--结束END--

本文标题: MySQL5.7单实例安装及开机启动配置(亲测)

本文链接: https://www.lsjlt.com/news/7634.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作