本人是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:
2:卸载MySQL:
卸载1:
如果装了mysql-devel(其他一样add command),卸载为:
安装完我指出的那些包以后,启动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操作
为了方便以后自己学习巩固
再贴上一些有用的资料
http://blog.csdn.net/yisheyuanzhang/article/details/50560835
到这里也差不多完成了
安装过程如果有其他问题可以去http://blog.csdn.net/typa01_kk/article/details/49059729 看看