Centos 7 安装mysql5.7.24二进制 版本的方法及解决办法
程序员文章站
2022-08-24 11:47:33
mysql 二进制安装方法
下载mysql
1.解压包
tar xf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz...
mysql 二进制安装方法
下载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二进制 版本的方法 ,希望对大家有所帮助
上一篇: 秋季过敏高发 日常生活7方面巧避免
下一篇: 秋冬为子宫保暖 防宫寒致不孕
推荐阅读
-
Centos7安装docker compse踩过的坑及解决方法
-
CentOS7.x卸载与安装MySQL5.7的操作过程及编码格式的修改方法
-
Linux下安装MariaDB数据库问题及解决方法(二进制版本的安装)
-
CentOS下PHP7的编译安装及MySQL的支持和一些常见问题的解决办法
-
Centos 7 安装mysql5.7.24二进制 版本
-
Centos 7 安装mysql5.7.24二进制 版本的方法及解决办法
-
阿里云Centos7下安装Redis及tomcat设置自启动的方法
-
centos7环境下二进制安装包安装 mysql5.6的方法详解
-
VirtualBox6安装CentOS7设置静态IP的方法及注意事项
-
Centos7 安装Node.js10以上版本的方法步骤