Home Database Mysql Tutorial Mysql5升级到Mysql5.5的方法_MySQL

Mysql5升级到Mysql5.5的方法_MySQL

May 27, 2016 pm 01:45 PM

安装5.5依赖安装包

代码如下


yum install -y autoconf* automake* zlib* libxml* ncurses-devel* libgcrypt* libtool* openssl*
Copy after login


  安装cmake

代码如下


yum install -y cmake
Copy after login


  在升级前,建议先将之前5.1的mysql及数据库目录备份一下

  停止掉mysql

代码如下


service mysql stop
Copy after login


升级mysql 5.5.36

代码如下


http://download.csdn.net/download/cike121272604/6943279
tar xf mysql-5.5.36.tar.gz
cd mysql-5.5.36
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DSYSCONFDIR=/etc -DMYSQL_DATADIR=/usr/local/mysql/var 
-DMYSQL_TCP_PORT=3306 -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DMYSQL_USER=mysql -DEXTRA_CHARSETS=all 
-DWITH_READLINE=1 -DWITH_SSL=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 
-DWITH_INNOBASE_STORAGE_ENGINE=1
make && make install
Copy after login


 删除/etc/下的my.cnf配置文件

代码如下


rm -rf /etc/my.cnf
Copy after login


拷贝5.5的配置文件

代码如下


cp support-files/my-huge.cnf /etc/my.cnf
Copy after login


尝试启动一下

代码如下


service mysql start
Copy after login


  执行更新程序并重启mysql

代码如下


/usr/local/mysql/bin/mysql_upgrade
Copy after login


  如果一路OK就没事儿,但要是出了错误,请参考我另外一篇文章 mysql5.5升级过程中mysql_upgrade失败的问题

  查看下现在的mysql版本

代码如下


cat mysql_upgrade_info
Copy after login


  好了,升级工作完成。

  再附升级失败问题解决

  在升级mysql5.5过程中,执行/usr/local/mysql/bin/mysql_upgrade

  提示:

代码如下


Looking for 'mysql' in: /usr/local/mysql/bin/mysql
Looking for 'mysqlcheck' in: /usr/local/mysql/bin/mysqlcheck
Running 'mysqlcheck'...
/usr/local/mysql/bin/mysqlcheck: Got error: 1064: You have an error in your SQL syntax; 
check the manual that corresponds to your MySQL server version for the right syntax to use 
near 'FOR UPGRADE' at line 1 when executing 'CHECK TABLE ... FOR UPGRADE'
FATAL ERROR: Upgrade failed
Copy after login


  想起之前5.1好像是有密码的!这儿换种方式尝试

代码如下


/usr/local/mysql/bin/mysql_upgrade -S /var/data/mysql.sock -uroot -p
Copy after login


  这个也不行了,突然想到出奇招,还是使用5.5的二进制程序,然后更改启动参数,因为我只想要把data目录下的表结构升级而已,必须指定的参数只是data目录,于是我做了如下尝试

  # 启用 --skip-grant-tables参数避开检查,先启动再说

代码如下


/usr/local/mysql/bin/mysqld --datadir=/usr/local/mysql/var/ --user=mysql --skip-grant-tables &
Copy after login
Copy after login


 # 看上去成功了

  # 中间报了一些innodb的错误,不去理会,应该是配置或是这个半阴半阳状态下问题,这个以后再解决

  # 接下来停止这个服务 mysqladmin shutdown 之,然后以正常参数启动mysqld服务…… 修改些my.cnf中的配置参数,以适合mysql5.5

  一句话总结:

代码如下

/usr/local/mysql/bin/mysqld --datadir=/usr/local/mysql/var/ --user=mysql --skip-grant-tables &
Copy after login
Copy after login


以上就是Mysql5升级到Mysql5.5的方法_MySQL的内容,更多相关内容请关注PHP中文网(www.php.cn)!




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)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
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)

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 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 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.

Explain InnoDB Full-Text Search capabilities. Explain InnoDB Full-Text Search capabilities. Apr 02, 2025 pm 06:09 PM

InnoDB's full-text search capabilities are very powerful, which can significantly improve database query efficiency and ability to process large amounts of text data. 1) InnoDB implements full-text search through inverted indexing, supporting basic and advanced search queries. 2) Use MATCH and AGAINST keywords to search, support Boolean mode and phrase search. 3) Optimization methods include using word segmentation technology, periodic rebuilding of indexes and adjusting cache size to improve performance and accuracy.

See all articles