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.
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
Try solution given in http://rtcamp.com/tutorials/mysql/mysql-5-6-ubuntu-12-04/#comment-64615
Very helpful.. Thanks
Same problem of Rob here: during “mysql_upgrade” it says:
Looking for ‘mysql’ as: mysql
Looking for ‘mysqlcheck’ as: mysqlcheck
FATAL ERROR: Upgrade failed
Thanks
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…
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.
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
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:
Thanks for the brilliant howto!
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.
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 ended
I have tried reinstalling libaio1 and also removing+installing it. No change. Any advice? Thanks!
Are you using 32-bit?
This might be related – http://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.
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!
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
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.
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. 🙂
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
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.
Excellent, saved me a lot of time to find it out myself, thanks a lot!
Cheers, Frank
I get
user@somewhere:~# wget -O mysql-5.6.deb https://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– https://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.
wget -O mysql-5.6.deb http://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.
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?
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.
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
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.cnf
and add lines to it. Looks like you are installing afresh.Try it. If it doesn’t work, just let us know.
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.
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
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. 🙂
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 – https://rtcamp.com/support/forum/wordpress-nginx/