FeaturesWP CloudPricingEE CLIContactMy Account
Features
Team Access & User Permissions
Install
Resources
Community
CLEAR
Tutorials
Mysql
Install/Upgrade to MySQL 5.6 on Ubuntu 12.04 LTS
Topics
On this page
-
- Getting Started
- Git and File-System Layout (non-default setup)
- Version Constraints
- Managing Themes and Plugins (for entire WordPress site)
- Updating Themes and Plugins (for entire WordPress site)
- Adding Composer Support to Your Own Themes and Plugins (for developers)
- Using Composer to Manage Own Theme/Plugin Dependencies (for developers)
-
- Assigning Multiple IP Addresses to Single LAN Card
- Disable IPv6 on Ubuntu 12.04
- dsh – distributed shell
- fdupes – find & replace duplicate files with hardlinks
- GPG Keys Cheatsheet
- Increase "Open Files Limit"
- kill all php, nginx, mysql or any kind of processes
- Passwordless Authentication for SSH
- Screen
- search replace in multiple files useing grep xargs sed
- Setup sftp
- sysctl.conf
- Timezone Sync
- Using Google Public DNS on Ubuntu Server
- Using openssl to match private key, cerificate and CSR
- Configure Postfix to Use Gmail SMTP on Ubuntu
- Logrotate Example for Custom Logs
- PHP 5.5, MySQL, Postfix, Nginx and WordPress on Ubuntu
- Serverdensity
- Upgrade Ubuntu 10.04 to 12.04
- Using find and sed to replace strings in multiple files
- Webmin
-
- .my.cnf – mysql user & password
- Analyse slow-query-log using Anemometer
- Improving MySQL Query Cache
- MySQL Query Profiling
- Reset MySQL root password
- tuning-primer.sh – an alternative for mysqltuner
- Using MariaDB 10
- Install/Upgrade to MySQL 5.6 on Ubuntu 12.04 LTS
- Change WordPress Domain Name
- Character Sets and Collations
- Enable innodb_file_per_table
- Enable Remote Access (Grant)
- Installing Percona Toolkit
- Using tmpfs for temporary folder creation
- YARPP and InnoDB
- Convert MyISAM to InnoDB
- Using tmpfs for mysqldump & mysqlimport
- Convert from INNODB to MYISAM
- Analyse slow-query-log using mysqldumpslow & pt-query-digest
- mysqlcheck with cron to optimize automatically
- Using MySQLTuner to Optimize MySQL configuration
-
-
- Directly connect to PHP-FPM
- Generating core-dump for php5-fpm
- GeoIP
- Having php5 and php7 on same system.
- Install Xdebug and configure it with webgrind
- Installation of PHP Code Review Tools
- memcache
- PHP's Zend Opcache Config & Web Viewer
- Setting Sqlite support with PHP
- Using HHVM with PHP-FPM Fallback
- Using Redis for PHP Sessions on Ubuntu Server
- Installing PhpMyAdmin Quickly
- Moving PHP's session storage to tmpfs
- Install Xdebug and configure it with Netbeans
- Nginx – Enable PHP-FPM Status Page
- PHP-FPM: Socket vs TCP/IP and sysctl tweaking
- APC Cache Optimization & Monitoring Using Web Interface
- Checking if PHP/WordPress can send mails
- Debugging PHP Scripts Using slow_log and more
- Increase file upload size limit in PHP-Nginx
- Increase PHP script execution time with Nginx
-
- Performance Optimization
- Remove Query string of css/js files
- Setup ElasticSearch with ElasticPress
- Using Redis for WordPress Object-Cache
- WooCommerce Window Shopping Caching Technique
- Moving WordPress To New Server (Faster)
- Better wp-cron using linux's crontab
- 404 error- Page not Found!!!
- Debugging WordPress with Nginx
Download & Install MySQL 5.6 deb package from official site
Backup MySQL 5.5 Data
Remove MySQL 5.5 Packages
Setup MySQL 5.6 Startup Script
Update Config & Environment settings
Update environment
Update mysql config file
Start MySQL 5.6
Final Step
Install/Upgrade to MySQL 5.6 on Ubuntu 12.04 LTS
I keep hearing good things about MySQL 5.6, so I decided to give it a try, even Ubuntu 12.04 LTS do not have launchpad repo for it. (atleast, as of July 10, 2013)
Download & Install MySQL 5.6 deb package from official site
You can get MySQL installers from https://dev.mysql.com/downloads/mysql/#downloads
I ran following command to get MySQL 5.6.14
wget -O mysql-5.6.deb http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.14-debian6.0-x86_64.deb
Then install Mysql 5.6.x
dpkg -i mysql-5.6.deb
and install dependency
apt-get install libaio1
Backup MySQL 5.5 Data
You will need this only if you are upgrading…
cd ~
mkdir backup && cd backup
mysqldump -A --events > dump/alldb.sql
cp -pr /etc/mysql config
service mysql stop
cp -pr /var/lib/mysql/ data
At this point your mysql is stopped and you have mysql’s data directory and mysqldump output in ~/backup directory. If all goes well you will not need backups!
Remove MySQL 5.5 Packages
apt-get remove mysql-common mysql-server-5.5 mysql-server-core-5.5 mysql-client-5.5 mysql-client-core-5.5
apt-get autoremove
Setup MySQL 5.6 Startup Script
cp /opt/mysql/server-5.6/support-files/mysql.server /etc/init.d/mysql.server
update-rc.d -f mysql remove
update-rc.d mysql.server defaults
Note: I am not sure why but renaming mysql 5.6’s startup script from mysql.server to mysql was throwing error.
Update Config & Environment settings
Update environment
MySQL 5.6 directory layout is different than Lauchpad packages.
vim /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/mysql/server-5.6/bin"
source /etc/environment
Confirm changes
Running… which mysql
Should show… /opt/mysql/server-5.6/bin/mysql
Update mysql config file
vim /etc/mysql/my.cnf
basedir = /opt/mysql/server-5.6
lc-messages-dir = /opt/mysql/server-5.6/share
You may also need to tweak few other settings.
For example:table_cache has been renamed to table_open_cache
Start MySQL 5.6
Its time to start new mysql…
service mysql.server start
If you are facing any issue during startup, refer to mysql error log.
Final Step
If you are upgrading from mysql, run command mysql_upgrade
Otherwise if its a fresh install, run following:
/opt/mysql/server-5.6/scripts/mysql_install_db --user=mysql --datadir=/var/lib/mysql
That’s it! Enjoy MySQL 5.6.
Change WordPress Domain Name
NEXT
Comments
-
Rob
I run the MySQL upgrade and receive the below error. Have you encountered this before? Other than this everything went smoothly so thank you very much for this tutorial!
Looking for ‘mysql’ as: mysql
Looking for ‘mysqlcheck’ as: mysqlcheck
FATAL ERROR: Upgrade failed -
himanshu
Very helpful.. Thanks
-
fabrizio
Same problem of Rob here: during “mysql_upgrade” it says:
Looking for ‘mysql’ as: mysql
Looking for ‘mysqlcheck’ as: mysqlcheck
FATAL ERROR: Upgrade failedThanks
-
fabrizio
Fixed: you need to use
mysql_upgrade -u root -p
That’s it
-
Thanks for sharing your solution. 🙂
Though error was odd in context of solution…
-
igid26
Everything runs fine for me until the upgrade. I was using 5.5.34 and upgraded to 5.6, but when I try mysql_upgrade -u root -p, it gives me:
Looking for ‘mysql’ as: mysql
Looking for ‘mysqlcheck’ as: mysqlcheck
FATAL ERROR: Upgrade failed-
Check mysql error log. There must be something in it indicating reason for issue.
-
-
-
Jose
mysql_upgrade -u root -p
Produced…
“Could not create the upgrade info file ‘/var/lib/mysql/mysql_upgrade_info’ in the MySQL Servers datadir, errno: 13”
I’ve tried a number of things with the same result: Ran as “sudo”, chmod’ed ‘/var/lib/mysql/mysql_upgrade_info’ to 777.
There is currently only one line in the file: “5.5.35”.
Any suggestions? Does this matter if everything else went fine?
-
-
-
You didn’t mention that user should run
/opt/mysql/server-5.6/scripts/mysql_install_db
if he installing MySQL on clean system. I think it’s important for new linux users.
-
I already have that command towards end of article:
/opt/mysql/server-5.6/scripts/mysql_install_db --user=mysql --datadir=/var/lib/mysql
-
-
Luther
Thanks for the brilliant howto!
-
Navneet
I am getting following error:
sh: 1: /opt/mysql/server-5.6/bin/my_print_defaults: not found
Installing MySQL system tables…sh: 1: /opt/mysql/server-5.6/bin/mysqld: not found-
Strange error. Never seen it.
If its a fresh server, better reinstall mysql. Looks like packages are not installed properly.
-
-
John
When I try to start mysql I get this in the error log:
131009 16:25:00 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/opt/mysql/server-5.6/bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
131009 16:25:00 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid endedI have tried reinstalling libaio1 and also removing+installing it. No change. Any advice? Thanks!
-
Are you using 32-bit?
This might be related – External link to stackoverflow.comhttp://stackoverflow.com/questions/10619298/libaio-so-1-cannot-open-shared-object-file
We shifted to percona-mysql recently so I am sorry but I won’t be able to reproduce this issue. Percona packages are very easy to install and maintain.
-
John
Nice call! The libaio.so.1 file is 64 bit but the mysqld is 32! I must have grabbed the wrong mysql file!
I’ll remove mysql and start over using a 64 bit version. THANK YOU SO MUCH!
-
John
Final comment: Yes, that fixed it! Woo hoo!
-
Glad to know that your issue is resolved. 🙂
-
-
-
-
-
If your mysql server isn’t starting, problem probably is that it can’t find a system message file. Check for it in the error log and execute the following:
cp /opt/mysql/server-5.6/share/english/errmsg.sys /usr/share/mysql/errmsg.sys
The server will start now
-
tiago
Starting service mysql on ubuntu with command service mysql.server start and the console say: The server quit without update PID file (/var/run/mysqld/mysqld.pid). Also mysql -u root: can’t could connect to socket at /var/run/mysqld/mysqld.sock. Help me!
-
Check mysql error log for details.
Most likely you will find answer there.
-
André Mácola
I resolve this problem by checking the my.cnf file. I had a duplicated lc-messages-dir line.
-
Glad to know that your issue got solved. 🙂
-
-
-
Just me
It’s been a bit since this tutorial was posted. Here are some issues
I bumped into. The wget will produce a 404. So, you’ll have to go to that
site directly. Set up an account. Then you’ll get access to that link where
you can download mysql manually. Then just change the name to “mysql-5.6.deb”
and start the tutorial on the second step. For those who might not know,
if you’re not running as root, you’ll
need to precede these commands with ‘sudo ‘.sudo dpkg -i mysql-5.6.deb
-
josete
Well, the wget works as long as you type in the whole string, including that strange
/from/http://cdn.mysql.com/at the end. That will surpass Sun login screen.
-
-
Frank
Excellent, saved me a lot of time to find it out myself, thanks a lot!
Cheers, Frank
-
Koos Kombuis
I get
user@somewhere:~# wget -O mysql-5.6.deb External link to dev.mysql.comhttps://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.12-debian6.0-x86_64.deb/from/http://cdn.mysql.com/
–2013-11-27 18:31:14– External link to dev.mysql.comhttps://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.12-debian6.0-x86_64.deb/from/http://cdn.mysql.com/
Resolving dev.mysql.com (dev.mysql.com)… 137.254.60.11
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:443… connected.
HTTP request sent, awaiting response… 404 Not Found
2013-11-27 18:31:17 ERROR 404: Not Found.-
Koos Kombuis
wget -O mysql-5.6.deb External link to cdn.mysql.comhttp://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.14-debian6.0-x86_64.deb
-
Thanks for update.
Looks like they removed old download link. It was latest though when I wrote this article!
I have updated article with latest link now. Thanks again. 🙂
-
-
-
Thanks for the tips! I had a little problem with the “table_cache”, but I found it on syslog and it worked like magic, all database still intact.
-
Mario
Hey Rahul Bansal,
That worked just fine to me, thanks! I’m trying to work in some instructions for do the rollback for 5.5 after upgrade using your instructions. But there is a issue related to start mysql service. Did you have this problem? Do you know how to fix it?
Thanks
-
Sorry couldn’t understood your problem. Do you having problem during rollback or upgrade?
-
-
Mário Areias
Well, I couldn’t find my last comment here. My problemas is related to do a downgrade, after upgrade. The upgrade went fine. Then I removed the /opt/mysql folder. Also, I changed the MySQL.cnf file to the old condiguration. But when I try to install mysql-server-5.5 again, it fails because the mysql service doesn’t start. Is there anything missing here?
-
Sorry. Never needed to downgrade back. So really do not have any idea.
-
Mário
Sure. Don’t worry. But do you know why the mysql service doesn’t start?
-
Please check mysql error log. Most likely
tail -f /var/log/mysql/mysql-error.log
-
-
-
-
Stephen Poland
Good tutorial, I don’t know if I’m missing something though, I’ve no my.cnf file in /etc – the /etc/mysql directory doesn’t exist. Should I create it and add the two lines?
sudo find / -iname my.cnf /opt/mysql/server-5.6/mysql-test/suite/ndb_rpl/my.cnf /opt/mysql/server-5.6/mysql-test/suite/rpl_ndb/my.cnf /opt/mysql/server-5.6/mysql-test/suite/ndb_binlog/my.cnf /opt/mysql/server-5.6/mysql-test/suite/federated/my.cnf /opt/mysql/server-5.6/mysql-test/suite/ndb_team/my.cnf /opt/mysql/server-5.6/mysql-test/suite/rpl/extension/bhs/my.cnf /opt/mysql/server-5.6/mysql-test/suite/rpl/my.cnf /opt/mysql/server-5.6/mysql-test/suite/ndb/my.cnf /opt/mysql/server-5.6/mysql-test/suite/ndb_big/my.cnf-
You can create
my.cnfand add lines to it. Looks like you are installing afresh.Try it. If it doesn’t work, just let us know.
-
-
Ganesan
while executing this command, I am getting the following issue/
apt-get install libaio1
Reading package lists…. Done
Building dependency tree
Reading state information…. Done
package libaio1 is not available, but is referred to by another package.
This may meant hat the package is missing, has been obsoleted, or
is only available from another source
E: Package ‘libaio1’ has no installation candidate.-
Search for missing package using command
apt-cache search libaio1. May be it’s present in another package. Alternatively, try continuing without that.I am sorry but I won’t be able to dig deeper as we have switched to percona-mysql.
-
-
Michael
I had to put the mysql-path at the beginngin of PATH to make which mysql point to opt instead of usr
-
If you get an error like
Starting MySQL * Couldn't find MySQL server (/opt/mysql/server-5.6/bin/mysql/bin/mysqld_safe)Then there’s a good chance you didn’t set the basedir correctly. Hope that helps someone! (I managed to miss that step and was confused for a bit)
-
Thanks for sharing your experience. It might help others. 🙂
-
-
Vishal Varshney
after this installation my php5 is not working and phpmyadmin and mysql-workbench removes
-
Sorry to say but I could not understand your problem. Please create a support request, with mysql error log content, in out forum – External link to rtcamp.comhttps://rtcamp.com/support/forum/wordpress-nginx/
-
Features
- Server Setup & Management
- Site Creation & Management
- Create WP Cloud Sites
- Speed & Caching
- Firewall Protection
- Backups & Recovery
- Logs & Monitoring
- Deployments & Developer Tools
- Team Access & User Permissions
Useful Links
Product
Other Products
Subscribe for curated product updates, tips, and announcements.
"*" indicates required fields
X/Twitter
This field is for validation purposes and should be left unchanged.
Email*
SIGN ME UP
Δ
© rtCamp, since 2009. All rights reserved.