search
HomeDatabaseMysql TutorialCentOS下MySQL卸载和安装

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。 

linux

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How do you alter a table in MySQL using the ALTER TABLE statement?How do you alter a table in MySQL using the ALTER TABLE statement?Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

How do I configure SSL/TLS encryption for MySQL connections?How do I configure SSL/TLS encryption for MySQL connections?Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

How do you handle large datasets in MySQL?How do you handle large datasets in MySQL?Mar 21, 2025 pm 12:15 PM

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

How do you drop a table in MySQL using the DROP TABLE statement?How do you drop a table in MySQL using the DROP TABLE statement?Mar 19, 2025 pm 03:52 PM

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

How do you represent relationships using foreign keys?How do you represent relationships using foreign keys?Mar 19, 2025 pm 03:48 PM

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

How do you create indexes on JSON columns?How do you create indexes on JSON columns?Mar 21, 2025 pm 12:13 PM

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)?How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)?Mar 18, 2025 pm 12:00 PM

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool