Home Database Mysql Tutorial CentOS下MySQL卸载和安装

CentOS下MySQL卸载和安装

Jun 07, 2016 pm 05:13 PM

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 of this Website
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

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 ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Reduce the use of MySQL memory in Docker Reduce the use of MySQL memory in Docker Mar 04, 2025 pm 03:52 PM

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

How to solve the problem of mysql cannot open shared library How to solve the problem of mysql cannot open shared library Mar 04, 2025 pm 04:01 PM

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

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.

Run MySQl in Linux (with/without podman container with phpmyadmin) Run MySQl in Linux (with/without podman container with phpmyadmin) Mar 04, 2025 pm 03:54 PM

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

What is SQLite? Comprehensive overview What is SQLite? Comprehensive overview Mar 04, 2025 pm 03:55 PM

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

Running multiple MySQL versions on MacOS: A step-by-step guide Running multiple MySQL versions on MacOS: A step-by-step guide Mar 04, 2025 pm 03:49 PM

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

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]

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]

See all articles