Centos 7 安装mysql5.7.24二进制 版本的方法及解决办法

作者:Mr.zou 时间:2024-01-21 22:18:58 

Mysql 二进制安装方法

下载mysql

https://dev.mysql.com/downloads/mysql/

1.解压包


tar xf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz

2.实际生产环境


mv mysql-5.7.24-linux-glibc2.12-x86_64 /usr/local/mysql5.7

a.新增Mysql用户组


groupadd mysql

b. 新增用户


opt]# useradd -r -g mysql mysql

C.给mysql 目录权限


chown -R mysql:mysql mysql5.7

3. 到初始化环境的目录


Cd /home/usr/local/mysql5.6/
mkdir data
mkdir log
chown -R mysql:mysql mysql5.7

4.初始化数据和指定安装目录和数据目录


./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql5.7/ --datadir=/usr/local/mysql5.7/data/

6复制启动文件


cp mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld

7.修改启动路径


vi /etc/init.d/mysqld
basedir= /usr/local/mysql5.7
datadir= /usr/local/mysql5.7/data

8.增加环境变量 (最下面添加)l


vi /etc/profile
export MYSQL_HOME=" /usr/local/mysql5.7"
export PATH="$PATH:$MYSQL_HOME/bin"

9.刷新配置文件


source /etc/profile

修改配置文件


vi /etc/my.cnf
[client]
port=3306
[mysqld]
basedir=/usr/local/mysql5.7
datadir=/usr/local/mysql5.7/data
#socket=/usr/local/mysql5.7/mysql.sock
socket=/tmp/mysql.sock
user=mysql
#skip-grant-tables
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
[mysqld_safe]
log-error=/usr/local/mysql5.7/log/mysqld.log
pid-file=/usr/local/mysql5.7/data/mysqld.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

11.添加开启自启


chkconfig --add mysqld
chkconfig mysqld on

12.启动mysqld


service mysqld start
netstat -anpt

13.修改密码(密码初始化的时候有个密码)


2018-11-02T02:07:44.574468Z 1 [Note] A temporary password is generated for root@localhost: lXyB0%fi#9-S (这个就是密码)
mysql> help contents
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> help contents
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

解决办法

1、 修改用户密码


mysql> alter user 'root'@'localhost' identified by 'youpassword';

或者


mysql> set password=password("youpassword");

2、刷新权限


mysql> flush privileges;
mysql> help contents

总结

以上所述是小编给大家介绍的Centos 7 安装mysql5.7.24二进制 版本的方法 网站的支持!

来源:https://www.cnblogs.com/zoulixiang/archive/2018/11/02/9895183.html

标签:Centos7,mysql5.7
0
投稿

猜你喜欢

  • sql如何删除数据库中数据记录

    2008-10-09 12:31:00
  • 支持中文的Len, Left, Right函数

    2008-03-18 13:50:00
  • 解决antd Form 表单校验方法无响应的问题

    2024-05-28 16:00:23
  • 熵值法原理及Python实现的示例详解

    2021-06-19 20:31:33
  • Python全局变量用法实例分析

    2023-08-03 13:39:18
  • OpenCV+Imutils实现图像的旋转操作

    2021-07-25 20:39:42
  • python中实现栈的三种方法

    2023-02-10 18:17:14
  • Python合并多个Excel数据的方法

    2022-11-02 06:31:33
  • Python去除、替换字符串空格的处理方法

    2022-07-17 05:38:25
  • python实现忽略大小写对字符串列表排序的方法

    2021-09-23 04:17:11
  • python发布模块的步骤分享

    2023-08-07 11:29:25
  • python字符串操作

    2022-11-30 18:04:40
  • python实现简易动态时钟

    2022-02-18 20:29:05
  • php 保留小数点

    2023-06-21 10:47:04
  • python进行参数传递的方法

    2023-05-21 06:15:32
  • python处理圆角图片、圆形图片的例子

    2021-06-08 15:20:15
  • MySQL中Replace语句用法实例详解

    2024-01-15 03:26:28
  • JavaScript求一组数的最小公倍数和最大公约数常用算法详解【面向对象,回归迭代和循环】

    2024-05-05 09:13:21
  • AI:如何训练机器学习的模型

    2023-01-16 13:18:49
  • 基于 Mysql 实现一个简易版搜索引擎

    2024-01-25 02:00:38
  • asp之家 网络编程 m.aspxhome.com