Red Hat Enterprise Linux 7 高薪入门pdf下载
命令:rpm -qa|grep -i mysql
---------------------------------------------------------
[test@localhost ~]$ rpm -qa|grep -i mysql
mod_auth_mysql-3.0.0-11.el6_0.1.x86_64
mysql-5.1.73-3.el6_5.x86_64
mysql-libs-5.1.73-3.el6_5.x86_64
mysql-server-5.1.73-3.el6_5.x86_64
mysql-devel-5.1.73-3.el6_5.x86_64
perl-DBD-MySQL-4.013-3.el6.x86_64
php-mysql-5.3.3-27.el6_5.x86_64
[test@localhost ~]$
-----------------------------------------------------------
说明已经安装
mysql-server
mysql_devel
2.停止MySQL服务
mysql服务命令有二种:一种是mysql,第二种是mysqld
方法一:service mysql stop
方法二:/etc/init.d/mysql shutdown
方法三:service mysqld stop
方法四:/etc/init.d/mysqld shutdown
------------------------------------------------------------
[test@localhost ~]$ service mysql stop
mysql: unrecognized service
[test@localhost ~]$ service mysqld stop
Stopping mysqld: [FAILED]
[test@localhost ~]$ su
Password:
[root@localhost test]# service mysql stop
mysql: unrecognized service
[root@localhost test]# service mysqld stop
Stopping mysqld: [ OK ]
[root@localhost test]#
------------------------------------------------------------
3.卸载mysql
卸载命令:rpm -e
强制卸载命令: rpm -e --nodeps
例如:
rpm -ev mysql-server-5.1.73-3.el6_5.x86_64
rpm -e --nodeps mysql-server-5.1.73-3.el6_5.x86_64
4.查询旧版本mysql的目录,病删除旧版本mysql的文件和库
查找命令:find / -name mysql
-------------------------------------------------------------
[root@localhost test]# find / -name mysql
/usr/include/mysqlclient/mysql
/usr/lib64/mysql
/usr/share/mysql
/var/lib/mysql
/var/lib/mysql/mysql
/home/test/Downloads/mysqlclient/include/mysql
-------------------------------------------------------------
删除旧版本mysql的文件和库
rm -rf /usr/lib64/mysql
rm -rf /usr/share/mysql
rm -rf /var/lib/mysql
注意:卸载后/etc/my.cnf不会删除,需要进行手工删除
rm -rf /etc/my.cnf
5.再次检查机器是否安装mysql
输入命令:rpm -qa|grep -i mysql
无结果则表示彻底卸载
6.yum命令在线安装mysql
6.1查看yum上可下载的mysql版本
输入命令:yum list | grep mysql
6.2使用yum安装mysql
输入命令:yum install -y mysql-server mysql mysql-devel
6.3查看mysql的版本
输入命令:rpm -qi mysql-server
6.4第一次运行mysql
输入命令: service mysqld start
注意:如果我们是第一次启动mysql服务,mysql服务器首先会进行初始化的配置
6.5设置mysql为开机自动启动
首先查看mysql是否是开机自动启动
-------------------------------------------------------
[root@localhost test]# chkconfig --list | grep mysql
mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off
---------------------------------------------------------
我们发现mysqld服务并没有开机自动启动,我们当然可以通过 chkconfig mysqld on 命令来将其设置成开机启动,这样就不用每次都去手动启动了
6.6修改mysql的登陆密码
-----------------------------------------
[root@localhost test]# mysqladmin -u root password '123456'
-----------------------------------------
CentOS 6.4下通过yum安装的MySQL是5.1版的,可以通过源代码安装高版本的5.6.14。
7.离线安装mysql
从http://dev.mysql.com/downloads/mysql/下载mysql源代码mysql-5.6.20.tar.gz
转载请注明:谷谷点程序 » 在CentOS 6.5下安装mysql