MySql教程

centos7安装mysql8

本文主要是介绍centos7安装mysql8,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

基础环境centos7.5,mysql版本8.0.20,通过tar包安装,安装路径/usr/local

参考https://www.cnblogs.com/kc19941205/p/14721580.html

 

 

首先将mysql-8.0.20-linux-glibc2.12-x86_64.tar.xz安装包上传到一个临时目录然后解压,注意压缩包是.tar.xz格式的,需要先解压、再解包

[root@CentOS7-1 tools]# xz -d mysql-8.0.20-linux-glibc2.12-x86_64.tar.xz 
[root@CentOS7-1 tools]# tar xf mysql-8.0.20-linux-glibc2.12-x86_64.tar -C /usr/local/

 

创建mysql用户

[root@CentOS7-1 tools]# useradd mysql
[root@CentOS7-1 tools]# passwd mysql
……密码相关提示操作……

 

重命名解压后的安装包目录,并修改目录的属主属组,

[root@CentOS7-1 tools]# cd /usr/local/
[root@CentOS7-1 local]# mv mysql-8.0.20-linux-glibc2.12-x86_64/ mysql
[root@CentOS7-1 local]# chown -R mysql.mysql mysql/

 

切换到mysql用户,在安装包下创建数据文件路径data

[mysql@CentOS7-1 local]$ cd mysql
[mysql@CentOS7-1 mysql]$ mkdir data

 

到bin目录下初始化数据库

[mysql@CentOS7-1 mysql]$ cd bin 
[mysql@CentOS7-1 bin]$ ./mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize
2021-12-07T16:29:25.936536Z 0 [Warning] [MY-010139] [Server] Changed limits: max_open_files: 1024 (requested 8161)
2021-12-07T16:29:25.936549Z 0 [Warning] [MY-010142] [Server] Changed limits: table_open_cache: 431 (requested 4000)
2021-12-07T16:29:25.937104Z 0 [Warning] [MY-011070] [Server] 'Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it' is deprecated and will be removed in a future release.
2021-12-07T16:29:25.937260Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.20) initializing of server in progress as process 111611
2021-12-07T16:29:25.954467Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-12-07T16:29:27.128120Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-12-07T16:29:28.520117Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: I<-VCdcL2kZb

 

切换到root用户,编辑配置文件/etc/my.cnf

 

这篇关于centos7安装mysql8的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!