ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

centos8安装mysql8.0

2021-09-20 11:01:27  阅读:323  来源: 互联网

标签:8.0 26 root 09 20T02 mysql8.0 mysql 安装 centos8


一、mysql安装包下载:

下载安装文档:MySQL :: MySQL 8.0 Reference Manual :: 2.2 Installing MySQL on Unix/Linux Using Generic Binaries

下载页面:MySQL :: Download MySQL Community Server

 

wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.26-linux-glibc2.12-x86_64.tar.xz

二、解压:

xz -d mysql-8.0.26-linux-glibc2.12-x86_64.tar.xz

解压tar包:

tar -xvf mysql-8.0.26-linux-glibc2.12-x86_64.tar -C /opt/mysql

前提需要/opt/mysql目录已经存在

cd /opt/mysql
mv mysql-8.0.26-linux-glibc2.12-x86_64 mysql-8.0.26
cd mysql-8.0.26
mkdir data
#编辑配置文件
vim /etc/my.cnf
[mysql]
default-character-set=utf8
[mysqld]
skip-name-resolve
port=3306
basedir=/opt/mysql/mysql-8.0.26
datadir=/opt/mysql/mysql-8.0.26/data
character-set-server=utf8
default-storage-engine=innodb
max_allowed_packet=32M

三、参照官方文档进行初始化:

[root@192 mysql-8.0.26]# bin/mysqld --initialize

2021-09-20T02:30:38.227555Z 0 [System] [MY-013169] [Server] /opt/mysql/mysql-8.0.26/bin/mysqld (mysqld 8.0.26) initializing of server in progress as process 24355
2021-09-20T02:30:38.229082Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2021-09-20T02:30:38.240237Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-09-20T02:30:38.671648Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2021-09-20T02:30:39.724283Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1 is enabled for channel mysql_main
2021-09-20T02:30:39.724790Z 0 [Warning] [MY-013746] [Server] A deprecated TLS version TLSv1.1 is enabled for channel mysql_main
2021-09-20T02:30:39.773235Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: WgqAwrysI1.&

[root@192 mysql-8.0.26]# bin/mysql_ssl_rsa_setup
[root@192 mysql-8.0.26]# bin/mysqld_safe --user=root &

[1] 24405
[root@192 mysql-8.0.26]# Logging to '/opt/mysql/mysql-8.0.26/data/192.168.127.147.err'.
2021-09-20T02:31:34.764783Z mysqld_safe Starting mysqld daemon with databases from /opt/mysql/mysql-8.0.26/data

四、连接mysql:

[root@192 mysql-8.0.26]# bin/mysql -uroot -pWgqAwrysI1.&
[2] 24626
[root@192 mysql-8.0.26]# bin/mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory

centos8环境下可能会报如上错误

解决办法:
sudo ln -s /usr/lib64/libtinfo.so.6.1 /usr/lib64/libtinfo.so.5

重新连接:

[root@192 mysql-8.0.26]# bin/mysql -uroot -p
#输入密码连接成功

五、修改密码:

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

六、配置远程连接

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set host='%' where user ='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

标签:8.0,26,root,09,20T02,mysql8.0,mysql,安装,centos8
来源: https://blog.csdn.net/yangzsirr/article/details/120388005

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有