MySQL – Upgrading MySQL 5.5 to 5.7

In this blog post, I will enumerate the steps to upgrade MySQL 5.5 to 5.7.

This is also known as the Logical Upgrade which involves exporting SQL from the old MySQL instance using a backup utility (mysqldump), installing the new MySQL server, and applying the SQL to your new MySQL instance.

1. Backup all your databases

 mysqldump -u root -p --add-drop-table --routines --events --all-databases --force > /backup/data-for-upgrade.sql

Note: Use the --routines and --events options with mysqldump (as shown above) if your databases include stored programs. The --all-databases option includes all databases in the dump, including the mysqldatabase that holds the system tables.

2.  Stop MySQL 5.5 instance

service mysqld stop

3. Move old datadir

mv /var/lib/mysql/ /var/lib/mysql-55

4. Install MySQL 5.7

5. Start MySQL

service mysqld start

6. Login to mysql with new root password

# Get temporary root password
grep 'temporary password' /var/log/mysqld.log

# Login to MySQL
mysql –u root –p

# Change root password
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password’;

7. Restore databases

mysql -u root -p < /backup/data-for-upgrade.sql

 

We have just performed the most cleanest and most stable upgrade path.

Cheers!

 

Knowledge worth sharing...Share on linkedin
Linkedin
Share on facebook
Facebook
Share on google
Google
Share on twitter
Twitter

MySQL – Restore a Single Table from a FULL mysqldump file

Use the sed command on your bash shell to separate the data of the table that you want to restore. For example, if we want to restore only the “film_actor” table to “sakila” database we execute the script below.


sed -n -e '/DROP TABLE.*`mytable`/,/UNLOCK TABLES/p' mydump.sql > tabledump.sql

You can now import the newly created table dump file into MySQL database.

mysql -u root -p sakila < film_actor.sql

Cheers!

Knowledge worth sharing...Share on linkedin
Linkedin
Share on facebook
Facebook
Share on google
Google
Share on twitter
Twitter

MySQL – Solution to Dependency Issues During MySQL Installation Using RPM

For complete steps on how to install MySQL 5.7 on Redhat, you may refer to this link

In this blog, I will show you specifically how simple it is to resolve the dependency issues that you might encounter while installing MySQL 5.7 on RedHat 6 using RPM.

Below are the dependency errors I encountered during installation.

The solution is simple. Just put the option –nodep at the end of the rpm command.

# rpm -ivh mysql-commercial-embedded-devel-5.7.21-1.1.el6.x86_64.rpm --nodeps

That’s it.

Cheers

Knowledge worth sharing...Share on linkedin
Linkedin
Share on facebook
Facebook
Share on google
Google
Share on twitter
Twitter

MySQL – Database Patch Upgrade on Windows Step-by-Step with Screenshots

1. Download the latest patch for MySQL in My Oracle Support. I choose MySQL installer for the integrated installer for windows.

1.1. Go to Patches & Updates. Chooose Product or Family (Advanced). Type MySQL Server on Products. Expand the options in the Release drop down and choose your desired release. Choose Microsoft Windows x64 in Platform option.

1.2. Choose the latest patch.

1.3. Click Download

2. Verify the current version

3. Backup databases

4. Double click on the patch

5. Click Next >

6. I will choose to upgrade all components. Click Next >

7. Click Execute.

8. Click Next >

9. Click Next  >

10. Enter root password then click Check. If the connection succeeded, Click Next >

11. Click Execute

12. Click Finish

13. Verify new MySQL version. Click Next >

14. Click Finish

This is how I upgrade the patch of our MySQL database on windows. Just be sure to backup your databases and/or if your server is a VM, ask your Windows Admin team to perform a VM snapshot of the server before you apply the patch.

Cheers!

Knowledge worth sharing...Share on linkedin
Linkedin
Share on facebook
Facebook
Share on google
Google
Share on twitter
Twitter