Linux 安装mysql (yum)

18 篇文章 0 订阅

1.查看系统已经安装的mysql

rpm -qa | grep mysql

2.删除

rpm -e --nodeps  *****

3. 下载

wget http://repo.mysql.com/mysql57-community-release-el6-10.noarch.rpm

4.安装

yum -y localinstall mysql57-community-release-el6-10.noarch.rpm

5.安装成功后在/etc/yum.repos.d/下会多出几个mysql的yum源的配置

ls -lh /etc/yum.repos.d/

6.安装mysql

yum -y install mysql-community-server

7.查看版本信息

 mysql -V

8.启动mysql

service mysqld start

查看状态:

service mysqld status

加入开机启动:

chkconfig mysqld on

9.配置数据库

vi  /etc/my.cnf

# 修改字符编码为utf8
character_set_server = utf8
init_connect = 'SET NAMES utf8'

# 数据库是否区分大小写,0:区分大小写,1:不区分大小写
lower_case_table_names=1

10.重启

service mysqld restart

11.查看初始密码

grep 'temporary password' /var/log/mysqld.log

12.进入数据库,修改密码

alter user 'root'@'localhost' identified by '123456';

报错:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

解决: set global validate_password_policy=LOW;

刷新权限

flush privileges;

13.查看数据库的字符集是否为配置的 utf8

show variables like "%character%";show variables like "%collation%";

14.navicat 连接mysql

报错:1130 - Host XXX is not allowed to connect to this MySQL server。

解决:进入mysql

use msyql

update user set host = '%' where user ='root';

grant all privileges on *.* to 'root'@'%' identified by '123456';

flush privileges;

 

 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值