安装MYSQL数据库

安装MYSQL数据库
MYsql linux apache java php
Sql sever windows IIS C#.net ASP asp.net
1.准备
安装文件:mysql57-community-release-el7-9.noarch.rpm
下载地址:wget http://repo.mysql.com/mysql57-community-release-el7-9.noarch.rpm
安装源:rpm -ivh mysql57-community-release-el7-9.noarch.rpm
yum makecache
[root@rhel:~]#rpm -qa|grep mariadb
mariadb-libs-5.5.52-1.el7.x86_64 ( 复制)
mariadb-5.5.52-1.el7.x86_64
mariadb-server-5.5.52-1.el7.x86_64
卸载旧数据库
[root@rhel:~]#rpm -e --nodeps mariadb-libs-5.5.52-1.el7.x86_64(粘贴)
[root@rhel:~]#rpm -e --nodeps mariadb-5.5.52-1.el7.x86_64
[root@rhel:~]#rpm -e --nodeps mariadb-server-5.5.52-1.el7.x86_64
[root@rhel:~]#rpm -qa|grep mariadb
2.安装mysql5.7
[root@rhel:~]#yum install mysql-server
Mysql-server-comminity-70w
mysql-community-server x86_64 5.7.21-1.el7
mysql-community-client x86_64 5.7.21-1.el7 mysql-community-common x86_64 5.7.21-1.el7
mysql-community-libs x86_64 5.7.21-1.el7
3.启动配置mysql5.7
[root@rhel:~]#rpm -qa|grep mysql
[root@rhel:~]#systemctl start mysqld
[root@rhel:~]#systemctl status mysqld
VI /etc/my.cnf 尾加入 skip-grant-tables (无密码登录)
[root@rhel:~]#systemctl restart mysqld
[root@rhel:~]#mysql –u root –p
Enter password : 回车(空密码)
Mysql> use mysql (SQL指令:打开数据库MYSQL)
Mysql> select host,user,authentication_string, password_expired, password_last_changed
from user; (SQL指令:c查询user数据表)
Myslq> update user set authentication_string=password(‘123456’) where user=‘root’ ;
(SQL指令:更新user数据表root用户的密码authentication_string值)
Mysql> flush privileges;(刷新密码)
Mysql> quit
VI /etc/my.cnf # skip-grant-tables
[root@rhel:~]#systemctl restart mysqld
[root@rhel:~]#mysql –u root –p
Enter password : (密码)
Mysql>

4.安全配置
[root@rhel:~]#mysql_secure_installation

Enter password for user root:
Change the password for root ? ((Press y|Y for Yes, any other key for No) : N
Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y 是否移除匿名用户
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : N 是否禁止mysql的root用户远程登录
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : N 是否移除test数据库,保留

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y 是否重新加载权限表
Success.

All done!
5.允许root用户远程登陆
修改validate_password_policy参数的值
mysql> set global validate_password_policy=0
mysql> SHOW VARIABLES LIKE ‘validate_password%’;

mysql>grant all privileges on . to ‘root’@’%’ identified by ‘Mysql123456’ with grant option;
( % 表示所有IP ,可用本机IP 192.168.163.1)
Mysql>use mysql
Myslq> update user set authentication_string=password(‘Mysql123456’) where user=‘root’ ;
Mysql>select user , host , authentication_string from user;
Mysql> flush privileges;

6.防火墙设置
Public区 :永久 服务Http ftp mysql 端口:80/tcp , 21/tcp, 3306/tcp

7.navicat 连接 mysql

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值