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

mysql 安装以及卸载 CentOS 7

时间:2019-01-25 20:04:13      阅读:264      评论:0      收藏:0      [点我收藏+]

标签:mysql 安装   undle   ota   5.7   erro   community   evel   pen   update   

wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.24-1.el7.x86_64.rpm-bundle.tar

安装:
mkdir mysql
tar -xf mysql-5.7.22-1.el7.x86_64.rpm-bundle.tar -C mysql
cd mysql

rpm -qa | grep mariadb
rpm -e mariadb-libs-5.5.56-2.el7.x86_64 --nodeps

yum -y install openssl openssl-devel libaio libaio-devel

rpm -ivh mysql-community-common-5.7.22-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.22-1.el7.x86_64.rpm
rpm -ivh mysql-community-devel-5.7.22-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.22-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.22-1.el7.x86_64.rpm

启动:
service mysqld start
grep ‘temporary password‘ /var/log/mysqld.log

修改root密码
mysql> alter user root@localhost identified by ‘Ad2cdf213@fb‘;

修改root登陆权限:
mysql> use mysql;
mysql> update user set host = ‘%‘ where user = ‘root‘;
mysql> select host, user from user;
mysql> flush privileges;

 

配置存储位置

1、修改配置文件

vim /etc/my.cnf

#datadir=/var/lib/mysql
datadir=/home/mysql/mysqldatadir01
socket=/var/lib/mysql/mysql.sock

#log-error=/var/log/mysqld.log
log-error=/home/mysql/mysqllog_error_01/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

2、然后把原先位置的数据全部拷贝到新的目录

cp -rf 。。。。。。

3、最后重启mysql验证

 

 

卸载

卸载mysql的方法:
首先停用mysql:  service mysqld stop
第一步:卸载所有mysql包
[root@iZbp1ddkszxcmrqic0imjwZ ~]# rpm -qa | grep mysql
mysql-community-common-5.7.21-1.el6.x86_64
mysql-community-devel-5.7.21-1.el6.x86_64
mysql-community-server-5.7.21-1.el6.x86_64
mysql-community-libs-5.7.21-1.el6.x86_64
mysql-community-client-5.7.21-1.el6.x86_64

卸载命令: rpm -e --nodeps mysql包

第二步:卸载mysql所有目录文件
[root@iZbp1ddkszxcmrqic0imjwZ ~]# find / -name mysql
/usr/share/mysql
/usr/include/mysql
/usr/include/mysql/mysql
/usr/bin/mysql
/usr/lib64/mysql
/root/mysql
/var/lib/mysql
/var/lib/mysql/mysql
/etc/logrotate.d/mysql
卸载命令: rm -rf mysql路径
第三步:卸载my.cnf. 和 /var/log/mysqld.log 文件
rm -rf /etc/my.cnf

 

mysql 安装以及卸载 CentOS 7

标签:mysql 安装   undle   ota   5.7   erro   community   evel   pen   update   

原文地址:https://www.cnblogs.com/shijunjie/p/10321220.html

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