linux下MySql安装及重装

1 卸载Mysql

yum remove  mysql mysql-server mysql-libs mysql-server;

find / -name mysql 将找到的相关东西delete掉;

rpm -qa|grep mysql(查询出来的东东yum remove掉)

2 安装mysql

#CentOS 7的yum源中貌似没有正常安装mysql时的mysql-sever文件,需要去官网上下载

wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

rpm -ivh mysql-community-release-el7-5.noarch.rpm

yum install mysql-community-server

#成功安装之后重启mysql服务

service mysqld restart

#初次安装mysql是root账户是没有密码的

mysql -uroot; #登录mysql控制台

use mysql; #进入系统数据库

UPDATE user SET Password = password ('123456') WHERE User = 'root' ; #设置密码

grant all privileges  on *.* to root@'%' identified by "123456"; #授权远程访问

你可能感兴趣的:(linux下MySql安装及重装)