设置 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
继续阅读
评论