[转帖]linux下如何安装新版的mysql_MySQL, Oracle及数据库讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MySQL, Oracle及数据库讨论区 »
总帖数
2
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 3705 | 回复: 1   主题: [转帖]linux下如何安装新版的mysql        下一篇 
骑着驴儿去编程
注册用户
等级:少校
经验:865
发帖:56
精华:2
注册:2013-2-1
状态:离线
发送短消息息给骑着驴儿去编程 加好友    发送短消息息给骑着驴儿去编程 发消息
发表于: IP:您无权察看 2013-2-6 15:13:48 | [全部帖] [楼主帖] 楼主

  安装linux的时候,若选择了mysql,安装系统的时候会自动安装mysql,若想安装新版本的mysql,如要将之前的安装的删除掉.
下面介绍如何删除之前的mysql重新安装新版本的mysql.

1.找到之前安装mysql

#rpm -qa grep -i mysql
php-mysql-5.1.6-5.el5
MySQL-python-1.2.1-1
mysql-bench-5.0.22-2.1
mysql-5.0.22-2.1
mysql-server-5.0.22-2.1
mysql-connector-odbc-3.51.12-2.2
mod_auth_mysql-3.0.0-3.1
mysql-devel-5.0.22-2.1
qt-MySQL-3.3.6-20.el5
perl-DBD-MySQL-3.0007-1.fc6


2.将以上的安装包逐个删除掉,将依赖的包也相应的删除掉

rpm -e php-mysql-5.1.6-5.el5
rpm -e MySQL-python-1.2.1-1
rpm -e mysql-bench-5.0.22-2.1
rpm -e mysql-5.0.22-2.1
rpm -e mysql-server-5.0.22-2.1
rpm -e mysql-connector-odbc-3.51.12-2.2
rpm -e mod_auth_mysql-3.0.0-3.1
rpm -e mysql-devel-5.0.22-2.1
rpm -e qt-MySQL-3.3.6-20.el5
rpm -e perl-DBD-MySQL-3.0007-1.fc6


直到如下命令没有任何结果输出为止

#rpm -qa grep -i mysql


3.安装新版本的mysql

[root@hxl ftp]# rpm -ivh MySQL-server-5.5.29-2.rhel5.i386.rpm
Preparing...                ########################################### [100%]
ls: /var/lib/mysql/*.err: No such file or directory
ls: /var/lib/mysql/*.err: No such file or directory
1:MySQL-server           ########################################### [100%]
[root@hxl ftp]# rpm -ivh MySQL-client-5.5.29-2.rhel5.i386.rpm
Preparing...                ########################################### [100%]
1:MySQL-client           ########################################### [100%]


4.安装完成以后启动mysql

[root@hxl subsys]# service mysql start
Starting MySQL...The server quit without updating PID file [FAILED]b/mysql/hxl.pid).


发现数据库无法启动,查看错误日志/var/lib/mysql/hxl.err,发现错误如下:

130130 22:30:32 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist


解决办法执行如下命令

#mysql_install_db --user=mysql


5.启动数据库

[root@hxl mysql]# service mysql start
Starting MySQL....                                         [  OK  ]


6.登录数据库

[root@hxl mysql]# mysql -h hxl -uroot
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.5.29 MySQL Community Server (GPL)
Copyright (c) 2000, 2012, 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>
mysql>
mysql>
mysql> select version();
+-----------+
version()
+-----------+
5.5.29
+-----------+
1 row in set (0.00 sec)


7.生成my.cnf文件
默认情况下mysql是不会生成my.cnf文件的,但可以进入到/usr/share/mysql/目录找一个cnf文件生成my.cnf文件,如下:

cp /usr/share/mysql/my-huge.cnf /etc/my.cnf


然后编辑my.cnf,按照需要修改或添加相应参数.

-- The End --


本文转自http://blog.chinaunix.net




赞(0)    操作        顶端 
yi.liao
注册用户
等级:少校
经验:917
发帖:52
精华:4
注册:2013-1-31
状态:离线
发送短消息息给yi.liao 加好友    发送短消息息给yi.liao 发消息
发表于: IP:您无权察看 2013-2-6 17:30:23 | [全部帖] [楼主帖] 2  楼

北京联动北方科技有限公司北京联动北方科技有限公司


赞(0)    操作        顶端 
总帖数
2
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论