MySQL下载,安装

梦想不抛弃苦心追求的人,只要不停止追求,你们会沐浴在梦想的光辉之中。再美好的梦想与目标,再完美的计划和方案,如果不能尽快在行动中落实,最终只能是纸上谈兵,空想一番。只要瞄准了大方向,坚持不懈地做下去,才能够扫除挡在梦想前面的障碍,实现美好的人生蓝图。MySQL下载,安装,希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com,来源:原文

下载MySQL

进入官网:https://dev.mysql.com/

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

选择系统和版本

在这里插入图片描述

根据所需下载

在这里插入图片描述

安装MySQL

[root@mysql-0001 ~]# tar xf mysql-8.0.31-1.el7.x86_64.rpm-bundle.tar
[root@mysql-0001 ~]# yum -y install *.rpm
[root@mysql-0001 ~]# systemctl enable mysqld --now
[root@mysql-0001 ~]# systemctl status mysqld.service
[root@mysql-0001 ~]# ss -utnlp | grep 3306
tcp    LISTEN     0      151    [::]:3306               [::]:*                   users:(("mysqld",pid=1449,fd=26))
tcp    LISTEN     0      70     [::]:33060              [::]:*                   users:(("mysqld",pid=1449,fd=21))

使用初始密码登录MySQL

#查看初始密码
[root@mysql-0001 ~]# grep password  /var/log/mysqld.log | tail -1
2022-11-02T13:57:55.589244Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: uSF!me.xs9jd
#登录MySQL
[root@mysql-0001 ~]# mysql -hlocalhost -uroot -p'uSF!me.xs9jd'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.31

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
#改密码才能使用
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql>

修改密码登录MySQL

#修改密码
mysql> alter user   root@"localhost" identified by "123zzz...A";
Query OK, 0 rows affected (0.01 sec)
#新密码登录MySQL
[root@mysql-0001 ~]# mysql -uroot -p123zzz...A
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.31 MySQL Community Server - GPL

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
#查看所有库
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

mysql>

MySQL配置文件


[root@mysql-0001 ~]# vim /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is enabled by
# default. It's default setting is log_bin=binlog
# disable_log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#
# Remove leading # to revert to previous value for default_authentication_plugin,
# this will increase compatibility with older clients. For background, see:
# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password

datadir=/var/lib/mysql		#MySQL数据存储目录
socket=/var/lib/mysql/mysql.sock		

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/154036.html

(0)
飞熊的头像飞熊bm

相关推荐

发表回复

登录后才能评论
极客之音——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!