[root@localhost root]# mysql -u root -S mysql_socket
ERROR 2002: Can't connect to local MySQL server through socket 'mysql_socket' (2)
I also stopped iptables -- that didn't do it.
[root@localhost root]# ln -s /var/lib/mysql/mysql.sock /tmp
ln: `/tmp/mysql.sock': File exists
Does this lend any insight--
=============from the tutorial, I did this==============
MySQL is "installed" but we have a few more steps until it's actually "done" and ready to start. First run the script which actually sets up MySQL's internal database (named, oddly enough, mysql).
Then we want to set the proper ownership for the MySQL directories and data files, so that only MySQL (and root) can do anything with them.
chown -R root:mysql /usr/local/mysql
chown -R mysql:mysql /usr/local/mysql/data
Copy the default configuration file for the expected size of the database (small, medium, large, huge)
cp support-files/my-medium.cnf /etc/my.cnf
chown root:sys /etc/my.cnf
chmod 644 /etc/my.cnf
If you get an error message about the data directory not existing, etc., something went wrong in the mysql_install_db step above. Go back and review that; make sure you didn't get some sort of error message when you ran it, etc.
Now we have to tell the system where to find some of the dynamic libraries that MySQL will need to run. We use dynamic libraries instead of static to keep the memory usage of the MySQL program itself to a minimum.
echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
Now we want to set up a startup script, which enables MySQL auto-start each time your server is restarted.
cp ./support-files/mysql.server /etc/rc.d/init.d/mysql
chmod +x /etc/rc.d/init.d/mysql
/sbin/chkconfig --level 3 mysql on
Then we set up symlinks for all the MySQL binaries, so they can be run from anyplace without having to include/specify long paths, etc.
for file in *; do ln -s /usr/local/mysql/bin/$file /usr/local/sbin/$file; done
Time to take care of some security issues.
First, we will assume that only applications on the same server will be allowed to access the database (i.e., not a program running on a physically separate server). So we'll tell MySQL not to even listen on port 3306 for TCP connections like it does by default. Edit /etc/my.cnf and add
to the [mysqld] section.
For more security info, check this great tutorial over at SecurityFocus. The chrooting part won't be too relevant, but all the other info is good to know.
Now we can start the MySQL server!
Let's "test" it to see what version we're running now:
Now we'll set a new password for the MySQL root user (not the same as the system root user!)
mysqladmin -u root password new-password