mysql的分区表功能自5.1才开始支持,centos的mysql为5.0的,需要将其卸载后安装5.1
mysql的分区表功能自5.1才开始支持,centos的mysql为5.0的,需要将其卸载后安装5.1
下面是一些操作、错误和解决方案的记录:
1.关闭目前的mysql服务
/etc/init.d/mysqld stop
2.确保已正常关闭
ps -ef | grep mysql
如果没关闭,kill之
3. 查询mysql的安装情况:
rpm -qa | grep mysql
将列出来的删除。
rpm -e mysql-server.x86_64
如果报有多个,则用项 --allmatches将其全部删掉
4. 下载mysql5.5的rpm版
rpm -ivh mysql-server和client
5. 启动新的mysql
/etc/init.d/mysql start
6. 尝试访问
mysql -uroot -p
我的 默认无密码,可正常访问
7.但是之前的php应用没法用了,报cannot load mysql extension .please check your php configuration
原因是刚才把php-mysql删了,其实是不应该删的。
8.重新安装php-mysql,我的系统为centos5.3,php为5.1.依赖的php-mysql也为5.1.yum安装php-mysql报:
libmysqlclient.so.15()(64bit) is needed
libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed
php-common is needed
libmysqlclient.so是包含在mysql-share的,但直接安装5.5版的mysql-share是不行的,因为该版本的没有libmysqlclient.so.15,都高于15.
需要到#downloads下载(mysql-shared-compat-5.1.62-1.rhel5.i386.rpm)
然后安装,但因为我支持装了5.5的mysql-share,会报冲突,即rpm安装时无法覆盖之前的,使用项--force强制覆盖即可。
rpm -ivh php-common-version php-mysql-version安装成功, 解决该问题
9.在为其他节点远程访问该服务器的数据库设置时出错,access denied for user 'root'@'localhost'。解决方案见:
,即:
mysql节点执行grant命令为spider服务器进行授权时,,发生了如下错误:
mysql> grant all on *.* to 'spider'@'spiderdb' identified by 'spider';
error 1045 (28000): access denied for user 'root'@'localhost' (using password: no)
可是我就是使用root用户登录的,root的password也是空的,怎么可能会发生这个错误呢。
网上有相同的错误,是登录不进mysql的解决办法。如果是忘记了密码,可以用下边的方法: # /etc/init.d/mysql stop
# mysqld_safe -u mysql --skip-grant-tables --skip-networking &
# mysql -u mysql
mysql> update user set password=password('newpassword')where user='root';
mysql> flush privileges;
mysql> exit
# /etc/init.d/mysqld restart
# mysql -uroot -pnewpassword
可是这个方法却解决不了我的问题。
网上还有一种办法,删除user.user中值为null的(delete from user where user is null),或更新null为test(update user set user=‘test‘ where user is null)。但是也不好使。
偶然发现对于单个db的授权是没有问题的,难道是root没有特定db的权限?写了个script对于每个database执行grant all on $database.* to 'root'@'localhost' identified by 'cps-pt' with grant option;,居然是information_schema的时候出错了。
前两天同志执行dump/restore的时候,db曾经死掉过,难道information_schema被破坏掉了。
这好像是mysql的一个restore时的bug。