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

 

上一篇:(Kettle) pdi-ce-8.2 连接MySQL8.x数据库时驱动问题之终极探讨及解决方法分析


下一篇:CentOS7安装MySQL8