LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   MySQL setup: I ran mysql_install_db ***without *** --user=mysql. (http://www.linuxquestions.org/questions/slackware-14/mysql-setup-i-ran-mysql_install_db-%2A%2A%2Awithout-%2A%2A%2A-user%3Dmysql-784372/)

slackmate 01-24-2010 07:59 AM

MySQL setup: I ran mysql_install_db ***without *** --user=mysql.
 
Hi,

I tried to install (enable rather) MySQL on Slackware 13. I followed the standard instrucitons - checked mysql user/goups were present, created my.cnf file, etc and then I ran the mysql_install_db script ***without*** the --user=mysql flag. Oops, Ouch. I was logged in as root.

When I tried to re-run the script with the flag it started erroing with problems like" 'mysql-bin.index file not found' - I fixed that by locating it and changing the ownership on it to mysql from root, but the script returns more errors - now it's 'mysql.db is not BASE TABLE'.

I do not know Linux well enough to go and fix all the damage I've caused by forgetting the --user=mysql flag. Is it at all possible to undo the install script and start over? I looked at the scripts in /usr/bin/ and could not see anything that would hint at this possibility. Does anyone know what to do? Many thanks in advance!

gbonvehi 01-24-2010 08:22 AM

Hi slackmate,
You should try removing (do a backup first, ALWAYS :) ) the contents of /var/lib/mysql and /var/run/mysql. Of course, stop mysql daemon first with sh /etc/rc.d/rc.mysql stop
Then, run mysql_install_db again.

tronayne 01-24-2010 08:27 AM

All you have to do is log in as root (or sudo) delete the entire /var/lib/mysql directory then execute mysql_install_db --user=mysql.

XGizzmo 01-24-2010 08:28 AM

Copied more or less from /etc/rc.d/rc.mysqld with a few edits.

To start MySQL automatically at boot, be sure this script is executable, do this as root:
# chmod 755 /etc/rc.d/rc.mysqld

To remove the databases and start over, do this as root:
# rm -rf /var/lib/mysql/*

To install an initial database, do this as root:
# mysql_install_db --user=mysql

To increase system security:
# mysql_secure_installation

slackmate 01-24-2010 06:58 PM

Deleting the contents of /var/lib/mysql and re-runing the script worked. /var/run/mysql/ was empty.

440Music 01-28-2010 06:54 PM

I followed the info in this post and didn't get mysql to start until I went to /var/lib/mysql

chown mysql:mysql -R mysql

Then mysql started and I was able to log-in and change password.

Tom


All times are GMT -5. The time now is 12:59 PM.