Skip to content

Instantly share code, notes, and snippets.

@vector4wang
Last active June 24, 2020 01:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vector4wang/f34fbba868eb4bd72a8fd1ef54e501f7 to your computer and use it in GitHub Desktop.
Save vector4wang/f34fbba868eb4bd72a8fd1ef54e501f7 to your computer and use it in GitHub Desktop.
[Centos下 mysql服务端的安装] #Linux #Mysql

1、找对应的rpm源 https://dev.mysql.com/downloads/repo/yum/

2、rpm -Uvh platform-and-version-specific-package-name.rpm

3、查看mysql版本

yum repolist enabled | grep "mysql.*-community.*"

4、指定默认的版本

yum repolist all | grep mysql

vi /etc/yum.repos.d/mysql-community.repo
# enabled=0

# 检查启用的mysql
yum repolist enabled | grep mysql

yum install mysql-community-server

5、启动

service mysqld start

# 查看状态
service mysqld status

# 停止
service mysqld stop

# 查看初始化root密码
grep 'temporary password' /var/log/mysqld.log

# 修改密码
# 进入数据库
mysql -uroot -p
# 使用复杂密码,MySQL默认的密码策略是要包含数字、字母及特殊字符;
# 如果只是测试用,不想用那么复杂的密码,可以修改默认策略,即validate_password_policy(以及validate_password_length等相关参数),使其支 持
# 简单密码的设定,具体方法可以自行百度;
# 修改配置文件/etc/my.cnf,添加validate_password=OFF,保存并重启MySQL

ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

# 允许root远程访问
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;

https://juejin.im/post/5d07cf13f265da1bd522cfb6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment