|Trying out MySQL5 without clobbering your MySQL4 installation|
|My Writings - Programming|
|Sunday, 18 December 2005 15:08|
MySQL5 has come out with a bunch of new features. If you want to try out the features of MySQL5 without clobbering your MySQL4, here is the way you can do it.
Compiling and installing MySQL5
You will need to compile your own version of mysql for this to work
- this way you would be able to add or remove your own features. Get
the source code Now,
compile it by specifying your own prefix and
unix-socket-path. That will allow you to run MySQL5
without worrying about it (MySQL5) interfering with your current MySQL
4 install. I usually install any experimental software by compiling
it with --prefix=/home/stormcrow/fakeroot/usr/local .
for file in `find / -type d -maxdepth 2` ; do echo mkdir /home/stormcrow/fakeroot$file ; done > /tmp/fkrootcreator.sh
This will give you a shell script (/tmp/fkrootcreator.sh ) that you can review and then run (source /tmp/fkrootcreator.sh) to mirror the directories in / to your ~/fakeroot
Now back to compiling MySQL5. I compiled it this way
Before you proceed further, it will be a good idea to review what the options mean that you are compiling MySQL5 with.
After you are done compiling, do a make and make install and you will have MySQL5 installed under /home/stormcrow/fakeroot/usr/local/bin/. Remember, you do not need to be root to do any of these steps. Next, check under the support-files in the MySQL source directory - you will find a bunch of my.cnf files. Copy the one that suits your needs to =/home/stormcrow/fakeroot/etc/my.cnf. Under the [mysqld] section change the port to 3307 (again to keep it seperate from the mysql4. You will also need to run /home/stormcrow/fakeroot/usr/local/bin/mysql_install_db to init the initial set of user tables. At this point you have your MySQL5 installed and ready to run.
Create a file in your /usr/bin/mysqld5_start with the following lines
#!/bin/bash /home/stormcrow/fakeroot/usr/local/bin/mysqld_safe --defaults-file=/home/stormcrow/fakeroot/etc/my.cnfDo a chmod +x /usr/bin/mysqld5_start on this. The reason for creating this file is to have an easy way to start the mysql5 daemon.
Create another file /usr/bin/mysql5
#!/bin/bash /home/stormcrow/fakeroot/usr/local/bin/mysql $*and do a chmod +x /usr/bin/mysql5. The reason for this is to have an easy way to start mysql5 client.
Now is a good time to see if things are working properly. Try this out
stormcrow|local$ mysqld5_safe stormcrow|local$ Starting mysqld daemon with databases from /home/stormcrow/fakeroot/usr/local/var stormcrow|local$ mysql5 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 5.1.3-alpha-debug-log Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> select version(); +-----------------------+ | version() | +-----------------------+ | 5.1.3-alpha-debug-log | +-----------------------+ 1 row in set (0.17 sec) mysql>Cool! Things are working now. If you want some dummy data to play around with, check out the world database
If you find any problems in this document, please contact me with suggestions (use the contact form)
|Last Updated ( Saturday, 06 January 2007 10:45 )|