AlmaLinux 9 安装 MySQL 8.0.32的详细过程

目录
  • 1、配置安装源
  • 2、安装MySQL
  • 3、配置MySQL
  • 4、修改配置文件
  • 5、启动MySQL
  • 6、安全配置

1、配置安装源

# 安装
dnf install http://mirrors.ustc.edu.cn/mysql-repo/mysql80-community-release-el9.rpm -y

# 修改配置
sed -i 's@http://repo.mysql.com/@http://mirrors.ustc.edu.cn/mysql-repo/@g' /etc/yum.repos.d/mysql-community*.repo

2、安装MySQL

dnf install -y mysql-community-server

3、配置MySQL

if [ ! "$(cat /usr/bin/mysqld_pre_systemd | grep -v ^\# | grep initialize-insecure )" ]; then
    sed -i "s@--initialize @--initialize-insecure @g" /usr/bin/mysqld_pre_systemd
fi

4、修改配置文件

[client]
port = 3306
socket = /var/lib/mysql/mysql.sock
default-character-set = utf8mb4
 
[mysql]
prompt="MySQL [\d]> "
no-auto-rehash
 
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
default_authentication_plugin = mysql_native_password
 
datadir = /var/lib/mysql
pid-file = /var/lib/mysql/mysql.pid
user = mysql
bind-address = 0.0.0.0
server-id = 1
 
init-connect = 'SET NAMES utf8mb4'
character-set-server = utf8mb4
collation-server = utf8mb4_0900_ai_ci
 
skip-name-resolve
#skip-networking
back_log = 300
 
max_connections = 5295
max_connect_errors = 6000
open_files_limit = 65535
table_open_cache = 1024
max_allowed_packet = 500M
binlog_cache_size = 1M
max_heap_table_size = 8M
tmp_table_size = 128M
 
read_buffer_size = 2M
read_rnd_buffer_size = 8M
sort_buffer_size = 8M
join_buffer_size = 8M
key_buffer_size = 256M
 
thread_cache_size = 64
 
ft_min_word_len = 4
 
log_bin = mysql-bin
binlog_format = row
binlog_expire_logs_seconds = 604800
 
log_error = /var/lib/mysql/mysql-error.log
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /var/lib/mysql/mysql-slow.log
 
performance_schema = 0
explicit_defaults_for_timestamp
 
lower_case_table_names = 1
 
skip-external-locking
 
default_storage_engine = InnoDB
#default-storage-engine = MyISAM
innodb_file_per_table = 1
innodb_open_files = 500
innodb_buffer_pool_size = 1024M
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_thread_concurrency = 0
innodb_purge_threads = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 2M
innodb_log_file_size = 32M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
 
bulk_insert_buffer_size = 8M
myisam_sort_buffer_size = 64M
myisam_max_sort_file_size = 10G
 
interactive_timeout = 28800
wait_timeout = 28800
 
binlog_rows_query_log_events = 1
log_bin_trust_function_creators = 1
log_timestamps = SYSTEM
 
sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
#sql_mode = NO_AUTO_VALUE_ON_ZERO
innodb_strict_mode = 0
plugin-load=mysql_clone.so
 
[mysqldump]
quick
max_allowed_packet = 500M
 
[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 8M
read_buffer = 4M
write_buffer = 4M

5、启动MySQL

systemctl enable --now mysqld

6、安全配置

# mysql_secure_installation
mysql_secure_installation: [ERROR] unknown variable 'default-character-set=utf8mb4'.
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
The 'validate_password' component is installed on the server.
The subsequent steps will run with the existing configuration
of the component.
Please set the password for root here.
New password:     #输入密码
Re-enter new password:      #输入密码
Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
 
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
 - Dropping test database...
Success.
 - Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.
All done!

到此这篇关于AlmaLinux 9 安装 MySQL 8.0.32的文章就介绍到这了,更多相关AlmaLinux安装mysql内容请搜索我们以前的文章或继续浏览下面的相关文章希望大家以后多多支持我们!

(0)

相关推荐

  • MySQL8.0.32的安装与配置超详细图文教程

    目录 1.下载 2.解压 3.安装 4.配置 副本 1.下载 地址:MySQL官网 2.解压 解压之后的文件里边是没有data文件的,需要创建一个空文件夹命名为data(后面需要用),并且需要创建一个初始化文件,命名为my,后缀名为.ini.my.ini文件以记事本方式打开输入以下配置设置信息 [mysqld] # 设置3306端口 port=3306 # 设置mysql的安装目录 ---是你的文件路径--- basedir=D:\develop\Mysql # 设置mysql数据库的数据的存放

  • Centos 7.9安装MySQL8.0.32的详细教程

    目录 第一步.下载压缩包 第二步,解压压缩包,并复制到安装目录 第三步.编辑配置文件 第四步.确定一些相关的目录 第五步.初始化数据库 第六步.启动数据库,连接并修改 root 密码 第六步.守护 MySQL 进程 第七步.验证 第一步.下载压缩包 下载社区版的 MySQL,根据需求下载对应版本,其中有最小安装版本.具体各个版本的区别,可以上网查询,链接MySQL :: Download MySQL Community Server 第二步,解压压缩包,并复制到安装目录 进入到压缩包所在的文件夹

  • AlmaLinux 9 安装 MySQL 8.0.32的详细过程

    目录 1.配置安装源 2.安装MySQL 3.配置MySQL 4.修改配置文件 5.启动MySQL 6.安全配置 1.配置安装源 # 安装 dnf install http://mirrors.ustc.edu.cn/mysql-repo/mysql80-community-release-el9.rpm -y # 修改配置 sed -i 's@http://repo.mysql.com/@http://mirrors.ustc.edu.cn/mysql-repo/@g' /etc/yum.re

  • centos7利用yum安装mysql 8.0.12

    本文为大家分享了centos7利用yum安装mysql 8.0.12的详细步骤,供大家参考,具体内容如下 清理原有的mysql rpm -qa | grep mysql #可能的显示情况如下 #mysql-community-libs-8.0.12-1.el7.x86_64 #mysql80-community-release-el7-1.noarch #mysql-community-client-8.0.12-1.el7.x86_64 #mysql-community-common-8.0.

  • linux 安装 mysql 8.0.19 详细步骤及问题解决方法

    最近买了个腾讯云服务器,搭建环境. 该笔记用于系统上未装过mysql的干净系统第一次安装mysql.自己指定安装目录,指定数据文件目录. linux系统版本: CentOS 7.3 64位 安装源文件版本:mysql-5.7.21-linux-glibc2.12-x86_64.tar.gz mysql安装位置:/software/mysql 数据库文件数据位置:/data/mysql 注:未防止混淆,这里都用绝对路径执行命令 除了文件内容中的#,这里所有带#都是linux命令 >mysql 是m

  • Centos6.5在线安装mysql 8.0详细教程

    Centos6.5在线安装mysql 8.0的顺序如下,希望大家可以顺利进行安装. Mysql卸载从下往上顺序 [root@localhost /]# rpm -e --nodeps qt-MySQL-4.6.2-26.el6_4.x86_64 [root@localhost /]# rpm -e --nodeps mysql-server-5.1.71-1.el6.x86_64 [root@localhost /]# rpm -e --nodeps mysql-libs-5.1.71-1.el

  • Centos7 安装mysql 8.0.13(rpm)的教程详解

    yum or rpm? yum安装方式很方便,但是下载mysql的时候从官网下载,速度较慢. rpm安装方式可以从国内镜像下载mysql的rpm包,比较快.rpm也适合离线安装. 环境说明 •操作系统:Centos7.4 (CentOS-7-x86_64-Minimal-1804.iso) •mysql:mysql8.0.13 •卸载系统自带的mariadb-lib •查看mariadb版本 rpm -qa|grep mariadb mariadb-libs-5.5.56-2.el7.x86_6

  • 安装mysql 8.0.17并配置远程访问的方法

    一.安装前准备 查看数据库版本命令: mysql --version mysql-community-common-8.0.17-1.el7.x86_64.rpm mysql-community-libs-8.0.17-1.el7.x86_64.rpm mysql-community-client-8.0.17-1.el7.x86_64.rpm mysql-community-server-8.0.17-1.el7.x86_64.rpm 二.安装RPM包 依次安装上述RPM包,前后安装包为依赖关

  • win10 安装mysql 8.0.18-winx64的步骤详解

    1.先去官网下载mysql 安装包 https://dev.mysql.com/downloads/mysql/ 2.下载完后解压到你想要安装MSQ 的文件目录下(如 D:\Mysql) 3.管理员命令运行 命令行,进入mysql 安装包的 bin 目录(D:\MySQL\mysql-8.0.18-winx64\bin) 4.执行 命令 mysqld --initialize --console (会自动生成data 文件夹,且生成临时密码,记住临时密码) 5.执行命令mysqld --inst

  • Linux(CentOS7)使用 RPM 安装 mysql 8.0.11的教程

    一.安装准备工作 1.查看 Linux 相关信息(Linux 命令行操作) (1)查看 Linux 版本,用于下载对应的 mysql. [查看 Linux 信息:] uname -a (2)检查是否已经安装过 mysql. [检查 mysql 是否被安装]  rpm -qa | grep -i mysql 若安装过,会输出相关包名 [若有安装过 mysql,则删除相关文件]  rpm -e [--nodeps] 包名(此处包名是上面命令查出来的名字) 2.下载 mysql (1)官网地址 [官网

  • CentOS 7安装MySQL 8.0.26的过程

    1.首先,根据自己的机子到MySQL官网下载对应的数据库https://dev.mysql.com/downloads/mysql/ 2.利用xftp上传压缩包到虚拟机或者服务器的某个文件夹中,最后把MySQL压缩包解压到自定义目录,如果你在Linux下载此步骤跳过(方法不限). 3.卸载mariadb数据库,先查看mariadb的安装包,然后卸载,最后可再次查看确认,命令如下: rpm -qa | grep mariadb rpm -e mariadb-libs-5.5.68-1.el7.x8

  • CentOS7安装MySQL 8.0.26的过程

    1.首先,根据自己的机子到MySQL官网下载对应的数据库https://dev.mysql.com/downloads/mysql/ 2.利用xftp上传压缩包到虚拟机或者服务器的某个文件夹中,最后把MySQL压缩包解压到自定义目录,如果你在Linux下载此步骤跳过(方法不限). 3.卸载mariadb数据库,先查看mariadb的安装包,然后卸载,最后可再次查看确认,命令如下: rpm -qa | grep mariadb rpm -e mariadb-libs-5.5.68-1.el7.x8

随机推荐