部署MySQL服务

DevOps MySQL评论4,765字数 1412阅读4分42秒阅读模式

设置 Repo

[root@hecs-x-large-2-linux-20200321161149 ~]# yum -y localinstall http://mirrors.ustc.edu.cn/mysql-repo/mysql57-community-release-el7.rpm

安装 MySQL

[root@hecs-x-large-2-linux-20200321161149 ~]# rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
[root@hecs-x-large-2-linux-20200321161149 ~]# yum install -y mysql-community-server

配置 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

启动 MySQL

[root@hecs-x-large-2-linux-20200321161149 ~]# systemctl enable mysqld
[root@hecs-x-large-2-linux-20200321161149 ~]# systemctl start mysqld

数据库授权

[root@hecs-x-large-2-linux-20200321161149 ~]# mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.41 MySQL Community Server (GPL)

Copyright (c) 2000, 2023, 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> create database jumpserver default charset 'utf8';
Query OK, 1 row affected (0.00 sec)

mysql> set global validate_password_policy=LOW;
Query OK, 0 rows affected (0.00 sec)

mysql> create user 'jumpserver'@'%' identified by 'KXOeyNgDeTdpeu9q';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all on jumpserver.* to 'jumpserver'@'%';
Query OK, 0 rows affected (0.01 sec)

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

mysql> exit
Bye

继续阅读
DevOps
  • 本文由 发表于 2023年2月24日 16:10:05
  • 除非特殊声明,本站文章均为原创,转载请务必保留本文链接
Yum安装MySQL8.0 MySQL

Yum安装MySQL8.0

安装mysql 安装前,我们可以检测系统是否自带安装 MySQL rpm -qa | grep mysql 普通删除模式 rpm -e mysql 强制删除 rpm -e --nod...
评论  0  访客  0

发表评论