码迷,mamicode.com
首页 > 数据库 > 详细

mysql安装rpm方式

时间:2017-12-25 11:29:29      阅读:221      评论:0      收藏:0      [点我收藏+]

标签:rpm安装mysql

查看系统中安装的rpm包

rpm -qa | grep mysql


卸载自带的mysql

rpm  -e  --nodeps   * 

解压mysql

tar -xvf mysql-5.7.18-1.el7.x86_64.rpm-bundle.tar



安装顺序

mysql-community-common-5.7.18-1.el7.x86_64.rpm

mysql-community-libs-5.7.18-1.el7.x86_64.rpm(依赖于common

mysql-community-client-5.7.18-1.el7.x86_64.rpm(依赖于libs

mysql-community-server-5.7.18-1.el7.x86_64.rpm(依赖于commonclient

mysql-community-devel-5.7.18-1.el7.x86_64.rpmMySQL头文件和库文件)

mysql-community-libs-compat-5.7.18-1.el7.x86_64.rpm

   执行如下命令:

rpm -ivh  mysql-community-common-5.7.18-1.el7.x86_64.rpm

rpm -ivh  mysql-community-libs-5.7.18-1.el7.x86_64.rpm

rpm -ivh  mysql-community-client-5.7.18-1.el7.x86_64.rpm

rpm -ivh  mysql-community-server-5.7.18-1.el7.x86_64.rpm

rpm -ivh  mysql-community-devel-5.7.18-1.el7.x86_64.rpm

rpm -ivh  mysql-community-libs-compat-5.7.18-1.el7.x86_64.rpm

如果报错则执行

 yum remove mariadb-libs

强制卸载


rpm -e --nodeps mariadb-libs-5.5.41-2.el7_0.x86_64

启动mysql命令

systemctl start mysqld

 查看是否启动成功:

systemctl  status  mysqld.service

重置mysql的密码

 vi /etc/my.cnf

在文件尾部添加

    character_set_server=utf8     --设置字符集

     init_connect='SET NAMES utf8'

     lower_case_table_names=1  --忽略大小写

     skip-grant-tables=1  --无密码方式进入mysql


重启 mysqld 服务命令

systemctl restart mysqld

然后输入 mysql -u root

use mysql;


update user set authentication_string = password('***'),

password_expired='N',password_last_changed = now() where user ='root'; FLUSH PRIVILEGES;


退出数据库

exit


把添加的配置文件的一行删掉,光标移动到最下面,按“i”键,删除skip-grant-tables=1


登录MYSQL

mysql -u root -p**

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '**' WITH GRANT OPTION;    --绝对不能少的一步;



CREATE DATABASE `**` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;










mysql安装rpm方式

标签:rpm安装mysql

原文地址:http://blog.51cto.com/9695005/2054161

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!