安装MySQL

来源:互联网 发布:知行论坛注册 编辑:程序博客网 时间:2024/06/09 20:08

昨日,在CentOS5.7下安装MySQL5.0.92,微笑安装成功。

       系统环境:

mysql版本:mysql-5.0.77-4.el5_6.6

新mysql版本:

MySQL-server-community-5.0.92-1.rhel5.i386.rpm 

MySQL-client-community-5.0.92-1.rhel5.i386.rpm

        现把安装过程分享给诸位!

     一、停掉mysqld服务

         # service mysqld stop

       二、卸载

1. 找出所有的MySQL版本包,然后一个个卸掉.

[root@localhost /]# rpm -qa | grep -i mysql

(1) 无依赖包的

[root@localhost/]# rpm -ev 包名
(2) 有依赖包的

yum -y remove 包名

2.找出含有mysql的所有文件夹和文件

[root@localhost /]# find / -name mysql

然后把找到的目录删除.

[root@localhost /]# rm -r 文件名

三、安装

1.安装Server

[root@localhost tmp]# rpm -ivh MySQL-server-community-5.0.92-1.rhel5.i386.rpm

2.安装Client

[root@localhost tmp]# rpm -ivh MySQL-client-community-5.0.92-1.rhel5.i386.rpm

完毕。


附:

安装日志

[xiaobin@localhost tmp]$ su - root口令:[root@localhost ~]# cd /[root@localhost /]# cd tmp[root@localhost tmp]# rpm -qa | grep -i mysqlmysql-server-5.0.77-4.el5_6.6mysql-5.0.77-4.el5_6.6perl-DBD-MySQL-3.0007-2.el5[root@localhost tmp]# rpm -ev mysql-server-5.0.77-4.el5_6.6warning: /var/log/mysqld.log saved as /var/log/mysqld.log.rpmsave[root@localhost tmp]# rpm -ev mysql-5.0.77-4.el5_6.6error: Failed dependencies:        libmysqlclient.so.15 is needed by (installed) perl-DBD-MySQL-3.0007-2.el5.i386        libmysqlclient.so.15(libmysqlclient_15) is needed by (installed) perl-DBD-MySQL-3.0007-2.el5.i386[root@localhost tmp]# rpm -ev perl-DBD-MySQL-3.0007-2.el5[root@localhost tmp]# rpm -ev mysql-5.0.77-4.el5_6.6[root@localhost tmp]# find / -name mysql/var/lib/mysql/var/lib/mysql/mysql[root@localhost tmp]# sudo rm -r /var/lib/mysql[root@localhost tmp]# rpm -qa | grep -i mysql[root@localhost tmp]# rpm -ivh MySQL-server-community-5.0.92-1.rhel5.i386.rpmPreparing...                ########################################### [100%]   1:MySQL-server-community ########################################### [100%]PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands:/usr/bin/mysqladmin -u root password 'new-password'/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'Alternatively you can run:/usr/bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default.  This isstrongly recommended for production servers.See the manual for more instructions.Please report any problems with the /usr/bin/mysqlbug script!The latest information about MySQL is available on the web athttp://www.mysql.comSupport MySQL by buying support/licenses at http://shop.mysql.comStarting MySQL.[确定]Giving mysqld 2 seconds to start[root@localhost tmp]# rpm -ivh MySQL-client-community-5.0.92-1.rhel5.i386.rpmPreparing...                ########################################### [100%]   1:MySQL-client-community ########################################### [100%][root@localhost tmp]# mysql -Vmysql  Ver 14.12 Distrib 5.0.92, for pc-linux-gnu (i686) using readline 5.1[root@localhost tmp]# mysqlWelcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.0.92-community MySQL Community Edition (GPL)Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;+--------------------+| Database           |+--------------------+| information_schema | | mysql              | | test               | +--------------------+3 rows in set (0.00 sec)mysql> 

原创粉丝点击