Linux 安装 mysql-8.0.18-linux-glibc2.12-x86_64.tar.xz

1.解压

tar  -xvf  mysql-8.0.18-linux-glibc2.12-x86_64.tar.xz

2.重命名并移动到/usr/local/路径

3.在/usr/local/mysql下创建data文件夹

mkdir data

4.初始化数据库,自动生成密码 需记录 等下要用

[root@localhost mysql]# bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

5.修改/usr/local/mysql 当前目录的用户

[root@localhost mysql]# chown -R root:root ./
[root@localhost mysql]# chown -R mysql:mysql data

6.配置/etc/my.cnf

7.开机自启,进入/usr/local/mysql/support-files进行设置

[root@localhost mysql]# cd support-files/
[root@localhost support-files]# cp mysql.server /etc/init.d/mysql
[root@localhost support-files]# chmod +x /etc/init.d/mysql 

8.注册服务

[root@localhost support-files]# chkconfig --add mysql

9.配置环境变量

vim /etc/profile
添加以下内容
#MYSQL ENVIRONMENT
export PATH=$PATH:/usr/local/mysql/bin:/usr/local/mysql/lib

保存退出
sourcer命令,让配置生效
source /etc/profile

至此可以执行  service mysql start

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值