MySQL5 install

Now I know I'm gonna be poopoohed about this but I'm gonna login as root for all this just to make things easier. I know, but I'll login as me after this is all done. Since we've got a running CentOS4.2 system now, go to MySQL and get the rpm's for RHEL4(x86). Server, client, headers and libraries and shared libraries should do, I don't think we'll need the debug stuff. Now lets put things in their place. I'm gonna create a new directory in /usr/src and call it localrepo and move the rpm's there. Then right click anywhere on the desktop and open a terminal, cd /usr/src/localrepo, and type 'createrepo /usr/src/localrepo'. Now we have to tell yum about the new repo. Open your favorite editor and type

[mylocal]

name=My local repo

baseurl=file:///usr/src/localrepo

gpgcheck=0

now save it as /etc/yum.repos.d/mylocal.repo then go back to the terminal and run 'yum update', now my system tells me that dovecot needs libmysqlclient.so.14, well I don't think I need dovecot just yet, so I'll remove it with the note that if I do want it in the future I may have to make a symlink to the new lib when the time comes. Ok, 'yum remove dovecot', now 'yum install MySQL*' again, now yum reports the public key for MySQL is not installed. So back to dev.mysql.com to get instructions to get the key and import it. They say to go to http://www.keyserver.net/ and type or copy and paste build@mysql.com into the search and it will return a page where you can download the key from. Save that in /usr/src/localrepo and in a terminal in that directory type 'gpg --import pubkey.asc'. Now back to 'yum install MySQL*' that will grab all 4 packages that we downloaded. As it suggests we should start the server which I found out is 'mysqld_safe'. Ok 1st major snag, mysql deamon won't start, mysqld says I should RTFM, security section about running mysqld as root, so back to the mysql manual. I figured out that you need to pick which my-size.cnf file from /usr/share/mysql and copy it to your /etc directory but first rename my.cnf to myold.cnf if you want. Now edit my.cnf, directly under [mysqld] add user=mysql, and 'chown -R /var/lib/mysql' then 'mysqld_safe &' and it starts, cooool. Mysql wants you to do that so it's not running as root. Next you have to set the passwords for root and delete the 'any' user.

shell> mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
mysql> SET PASSWORD FOR 'root'@'host_name' = PASSWORD('newpwd');
mysql> DELETE FROM mysql.user WHERE User = '';
mysql> FLUSH PRIVILEGES;

and we're done with Mysql for now.