先rpm -qa | grep mysql
查看所有与 mysql相关联的依赖
然后使用 yum remove XXXXX相应的依赖
----------------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------------
安装新的mysql
方法一:
#yum -y install mysql-server
安装完了后,启动服务
/etc/rc.d/init.d/mysqld start
更改密码
/usr/bin/mysqladmin -u root password "new-password";
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
方法二。
#yum -y install cmake
# yum -y install gcc-c++
yum install -y ncurses-devel bison
wget http://mysql.he.net/Downloads/MySQL-5.5/mysql-5.5.19.tar.gz
wget http://www.cmake.org/files/v2.8/cmake-2.8.6.tar.gz
groupadd mysql
useradd mysql -g mysql -M -s /sbin/nologin
mkdir -p /usr/local/mysql/data
mkdir -p /usr/local/mysql/log
chmod +w /usr/local/mysql
tar zxvf cmake-2.8.6.tar.gz
tar zxvf mysql-5.5.19.tar.gz
cd cmake-2.8.6
./bootstrap
gmake
gmake install
cd ../mysql-5.5.19
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/usr/local/mysql/data -DMYSQL_USER=mysql -DWITH_DEBUG=0
make
make install
cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chown -R mysql:mysql /usr/local/mysql
ln -s /usr/local/mysql/lib/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16
ln -s /usr/local/mysql/bin/mysql /sbin/mysql
ln -s /usr/local/mysql/bin/mysqladmin /sbin/mysqladmin
ln -s /usr/local/mysql/bin/mysqldump /sbin/mysqldump
cp support-files/my-huge.cnf /etc/my.cnf -f
/usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql
chkconfig --add mysqld
chkconfig --level 2345 mysqld on
service mysqld start
mysqladmin -u root password "yourpasswd"
mysql -u root -p
--转自