red hat7 装在mysql

本人是linux的初学者 

最近闲来无事 便跟着刘遄老师的书自学起Linux来 

在安装了虚拟机之后 捣鼓起了工作环境所需的一些软件

在装mysql的过程中遇到了一系列的问题 


记录下来 供自己以后再遇到这样的问题有地方参考 


因为yum源里没有mysql  只能从官网下


自己选择的是最新版本的 即 rhel7下 的mysql5.7.14版本


安装之前需要先rhel7自带的mariadb 否则会引起冲突 rpm -qa | grep mariadb

rpm -e --nodeps (软件包)  (不同操作系统可能不一样)


然后解压下载完的tar包


tar -xvf  需要解压的文件 -C 解压到哪个包 (解压的命令根据你下载的软件包类型改动,我这里下的是.tar文件)


解压出来的文件有




我们这里需要的包有如下箭头指出的包







我自己在安装community.common的过程中发现老是说文件冲突 后来才发现原因是我之前安装的mysql5.6版本的还没完全删除 

关于如何完全删除mysql 可以去看http://blog.csdn.net/typa01_kk/article/details/49057073这篇文章

我这里只从里面 截取了自己用到的语句


1:查看MySQL是否安装:

 方式1:

[plain]  view plain  copy
  1. [root@localhost usr]# yum list installed mysql*  
  2. Loaded plugins: fastestmirror  
  3. Loading mirror speeds from cached hostfile  
  4.  * base: mirrors.yun-idc.com  
  5.  * extras: mirror.neu.edu.cn  
  6.  * updates: mirrors.yun-idc.com  
  7. Installed Packages  
  8. MySQL-client.x86_64   5.6.27-1.el6    installed  
  9. MySQL-devel.x86_64    5.6.27-1.el6    installed  
  10. MySQL-server.x86_64   5.6.27-1.el6    installed  
  11. [root@localhost usr]#  

2:卸载MySQL:

卸载1:

[plain]  view plain  copy
  1. [root@localhost usr]# yum remove mysql mysql-server mysql-libs compat-mysql51  
  2. [root@localhost usr]# rm -rf /var/lib/mysql  
  3. [root@localhost usr]# rm /etc/my.cnf  

如果装了mysql-devel(其他一样add command),卸载为:

[plain]  view plain  copy
  1. [root@Tony_ts_tian init.d]# yum remove mysql mysql-devel mysql-server mysql-libs compat-mysql51  



安装完我指出的那些包以后,启动mysql 服务 service mysqld start 

mysql服务端安装完以后 系统会为mysql随机生成一个密码


1.查看初始密码:(这里转载于http://www.th7.cn/system/lin/201607/172036.shtml)

[root@VM_225_102_centos ~]# grep 'temporary password' /var/log/mysqld.log 
2016-07-08T02:25:46.311098Z 1 [Note] A temporary password is generated for root@localhost: MtPqF0/oN5zo

即初始密码为 MtPqF0/oN5zo   

2.登录及修改密码:


[root@VM_225_102_centos ~]# mysql -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or /g.
Your MySQL connection id is 4
Server version: 5.7.11


Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.


Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.


mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.


登录之后 第一步必须先修改密码,否则其他操作都执行不了。

修改密码的方法:

mysql> alter user root@localhost identified by 'tyzZ001!';
Query OK, 0 rows affected (0.00 sec)

新修改的密码中 必须包含 大小写字母数字及符号






之后便可进行相关的mysql操作

为了方便以后自己学习巩固

再贴上一些有用的资料


linux下mysql5.7.x版本忘记root初始密码

http://blog.csdn.net/yisheyuanzhang/article/details/50560835   






到这里也差不多完成了 

安装过程如果有其他问题可以去http://blog.csdn.net/typa01_kk/article/details/49059729 看看 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值