主页 > 手机  > 

使用mysql官网软件包安装mysql

确定你的操作系统,我的是Centos

myqsl 所有安装包的地址:https://repo.mysql.com/yum/

如果你是使用rpm安装你可以到对应的版本里面找到对应的包。

mysql 发行包的地址:http://repo.mysql.com/

在这里你可以找到对应的发布包安装。

这里使用yum的安装方式。

使用yum安装也有两种方式,下面介绍一下;

配置yum仓库,安装。

你可以修改为对应版本,这里使用的是mysql5.7

[root@localhost ~]# cd /etc/yum.repos.d/ [root@localhost yum.repos.d]# cat mysql.repo [mysql-5.7-community] name=mysql-5.7-community Server baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/ enabled=1 gpgcheck=0 [root@localhost yum.repos.d]# yum -y install mysql-community-server [root@localhost yum.repos.d]# systemctl start mysqld [root@localhost ~]# systemctl status mysqld ● mysqld.service - MySQL Server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled) Active: active (running) since 五 2024-03-29 10:36:16 CST; 11min ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 8978 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS) Process: 8929 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS) Main PID: 8981 (mysqld) CGroup: /system.slice/mysqld.service └─8981 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid 3月 29 10:36:12 localhost.localdomain systemd[1]: Starting MySQL Server... 3月 29 10:36:16 localhost.localdomain systemd[1]: Started MySQL Server. 安装发布包进行安装

你可以下载指定版本的发行包,这里使用的是mysql5.7

[root@localhost ~]# yum -y install http://repo.mysql.com/mysql57-community-release-el7.rpm [root@localhost ~]# yum -y install mysql-community-server --nogpgcheck [root@localhost ~]# systemctl start mysqld [root@localhost ~]# systemctl statusmysqld --nogpgcheck 禁用gpg检查

登录,并修改密码。

[root@localhost ~]# grep 'temporary password' /var/log/mysqld.log

修改密码

MySQL 的 validate_password 插件是默认安装的。这要求密码至少包含 1 个大写字母、1 个小写字母、1 个数字和 1 个特殊字符,并且密码总长度至少为 8 个字符。

可以修改密码的强度,并修改密码的长度。

mysql> set global validate_password_policy=0; 设置密码的强度为低级 mysql> set global validate_password_length=4; 设置密码的长度为4

mysql> set global validate_password_policy=0; Query OK, 0 rows affected (0.00 sec) mysql> set global validate_password_length=4; Query OK, 0 rows affected (0.00 sec) mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456'; Query OK, 0 rows affected (0.00 sec) mysql> \q Bye [root@localhost ~]# mysql -uroot -p123456 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 3 Server version: 5.7.44 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>
标签:

使用mysql官网软件包安装mysql由讯客互联手机栏目发布,感谢您对讯客互联的认可,以及对我们原创作品以及文章的青睐,非常欢迎各位朋友分享到个人网站或者朋友圈,但转载请说明文章出处“使用mysql官网软件包安装mysql