Mysql 8.0.12解压版安装

Mysql 8.0.12解压版安装

下载安装包

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

 

解压:

xz -d wyk/mysql-8.0.12-linux-glibc2.12-x86_64.tar.xz

tar -xvf wyk/mysql-8.0.12-linux-glibc2.12-x86_64.tar -C /usr/local/

改文件夹名

mv mysql-8.0.12-linux-glibc2.12-x86_64 mysql

添加mysql用户&用户组

groupadd mysql

useradd -g mysql mysql

建数据文件夹

​​​​​​​cd mysql

mkdir data

mkdir data/mysql

配置文件/etc/my.cnf

[client]

port=3306

default-character-set=utf8

socket=/usr/local/mysql/data/mysql.sock

[mysqld]

socket=/usr/local/mysql/data/mysql.sock

basedir=/usr/local/mysql

datadir=/usr/local/mysql/data

# 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/mysql/log/error.log

pid-file=/usr/local/mysql/data/mysql.pid



#

# include all files from the config directory

#

!includedir /etc/my.cnf.d

配置文件中修改了日志文件路径,需手动创建文件

mkdir log

touch error.log

授权

chown -R mysql:mysql mysql/

 

root账号初始化MYSQL

bin/mysqld --initialize --user=mysql

 

初始root密码在这里

 

 

添加mysql服务:

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

 

启动mysql服务

service mysql start

关闭mysql服务

service mysql stop

添加开机启动服务

chkconfig --add mysql

 

添加环境变量

vim /etc/profile

export MYSQL_HOME=/usr/local/mysql

PATH=$MYSQL_HOME/bin:$PATH

source /etc/profile

 

如果启动服务或者进入mysql失败,可以删除data目录下的所有内容,然后检查/etc/my.cnf,然后重新初始化mysql

 

修改mysqlroot用户密码,root初始密码为在日志中上面有提到

进入数据库命令:mysql -u root –p

 

修改密码命令:SET PASSWORD = 'new password';

刷新权限命令:flush privileges;

查看数据库user表,注意mysql 5.8密码字段改为authentication_string

  命令:select host,user,authentication_string from user;

 

配置远程登录

  修改远程登登录命令:update user set `Host` = '%' where `User` = 'root' limit 1;

  然后刷新权限命令:flush privileges;

退出数据库

  命令:quit;

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

王义凯_Rick

遇见即是缘,路过就给个评论吧~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值