Update April 23, 2012
I added new instructions for adding the MySQL libs to the loader path. Failure to add the libs to the loader path will cause errors when you try to run/build programs that depend on MySQL, such as installing the MySQL driver for Pyramid (Python).
Update April 18, 2012
Thanks to Lampros for pointing out that WordPress was converting double dashes into single dashes “-“. I have updated the post so that double dashes are displayed correctly.
The following are installation notes for MySQL 5.5 on Ubuntu 10.04 LTS running on the Rackspace cloud.
Download MySQL
Download the MySQL package from http://www.mysql.com in the ~/Downloads directory.
Download the following package from http://www.mysql.com/downloads/mysql/#downloads by selecting Debian Linux from the Select Platform drop-down list:
mysql-5.5.22-debian6.0-x86_64.deb
Installation Prerequisities
After the download is complete, open a terminal and execute the following commands:
Note:
libpthread-stubs0 libpthread-stubs0-dev coreutils are really not required, but I installed them as I was working through another issue.
apt-get install build-essential cmake libncurses5-dev libaio-dev bison libpthread-stubs0 libpthread-stubs0-dev coreutils
Setup the MySQL User and Group
groupadd mysql
useradd -r -g mysql mysql
Install MySQL
cd ~/Downloads
dpkg -i mysql-5.5.22-debian6.0-x86_64.deb
Note:
MySQL is now installed into the following directory:
/opt/mysql/server-5.5
cd /opt
chown root:root mysql
cd mysql
chown root:root server-5.5
cd server-5.5
chown -R mysql:mysql ./*
./scripts/mysql_install_db --user=mysql
chown mysql:mysql ./*
cd lib
chown -h mysql libmysqlclient.so libmysqlclient.so.18 libmysqlclient_r.a libmysqlclient_r.so libmysqlclient_r.so.18 libmysqlclient_r.so.18.0.0
cd ../support-files/
Note:
Decide which of the configuration files meets your needs, then copy it to /etc.
cp my-medium.cnf /etc/my.cnf
cp mysql.server /etc/init.d/mysql
Add MySQL to PATH
vi /etc/environment
Add the following to the end of the path:
/opt/mysql/server-5.5/bin
Example:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/mysql/server-5.5/bin"
source /etc/environment
Start the MySQL Server
/etc/init.d/mysql start
Set the MySQL Server to Start on Boot
update-rc.d mysql defaults
Create a root Password and Secure the Server
The following is the most basic and minimal security, but the steps below are required for a production server.
/opt/mysql/server-5.5/bin/mysql_secure_installation
Check the security settings:
mysql -u root -p
mysql> use mysql;
mysql> SELECT User, Host, Password FROM mysql.user;
Note:
None of the password fields should be blank.
Add the MySQL Libs to the Loader Path
We now need to update our loader path to include the MySQL libs. This is important for any future work we do that depends on the MySQL libraries, such as installing a MySQL driver for Pyramid.
cd /etc/ld.so.conf.d vi mysql.conf
Paste in the following:
# MySQL 5.5 Libraries /opt/mysql/server-5.5/lib ldconfig
Post installation checks
mysqladmin version -u root -p
mysqladmin variables -u root -p
Hello my friend.
Congratulations – your instructions are the ONLY ones that ACTUALLY WORKED for me on Ubuntu 10.04 LTS ! All the commands worked copy-paste style! ..only one super minor correction:
./scripts/mysql_install_db –user=mysql
should be:
./scripts/mysql_install_db –user=mysql
perhaps the WordPress blog messed this up? Thanks again for an excellent post!
indeed wordpress kills the format – it knows everything, right?
command should be
Lampros, thanks for pointing out the issue with WordPress and double dashes. I have now wrapped all commands in
...
so that double dashes are displayed correctly.Ubuntu 10.04 LTS was not working for me before installing MYSQL. Within WordPress, I was finally able to establish this software and it seems to be working well.
Didn’t work for me.
“:/opt/mysql/server-5.5$ sudo ./scripts/mysql_install_db –user=mysql
Installing MySQL system tables…
Installation of system tables failed! Examine the logs in
/var/lib/mysql for more information.
You can try to start the mysqld daemon with:
shell> /usr/sbin/mysqld –skip-grant &
and use the command line tool /usr/bin/mysql
to connect to the mysql database and look at the grant tables:
shell> /usr/bin/mysql -u root mysql
mysql> show tables
Try ‘mysqld –help’ if you have problems with paths. Using –log
gives you a log in /var/lib/mysql that may be helpful.
Please consult the MySQL manual section
‘Problems running mysql_install_db’, and the manual section that
describes problems on your OS. Another information source are the
MySQL email archives available at http://lists.mysql.com/.
Please check all of the above before mailing us! And remember, if
you do mail us, you MUST use the /usr/scripts/mysqlbug script!”
Of course, nothing is written to any logs.