1

running openSuse 12.1 . on a notebook...

well i configured apache 2 and mysql - (after starting it on the runlevel.

well - i did all i needed to do - but now i stuck....

after installing phpmyadmin . i tried to find the site ... i couldnt

then i tried to start the mysql via command line - which failed ... duhhhhhh!!?? What can i do now - what is wrong here

linux-wyee:/home/martin # mysql start 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
linux-wyee:/home/martin #

hmmm i have no glue - probably i have messed up some passwords . what do you think! how can i make sure that all runs nice -and nothing - that means no pART OF the apache2, mysql and all that things quits to work propperly

1

2 Answers 2

2

maybe you should use systemctl to start the mysql server daemon

sudo systemctl start mysql.service

Also if you want to add the server to the suse standard runlevels you should use:

sudo systemctl enable mysql.service

Next up you must execute mysql_secure_installation as root.

sudo mysql_secure_installation

here you must follow the steps and enter the password for the root mysql user. note that this is not the root user of your linux box.

Now simply use the mysql client. Simply issue

mysql

^^And remember you are on suse. Something sugested like rcscript start would not work because suse is using systemd now.

1
  • Hello and good day! Great to hear from you!! i will do all you adviced. i come back and report all my findings! Greeting
    – zero
    Mar 13, 2012 at 21:04
1

Your mysql install is just complaining that you can't connect to the instance on mysql locally as root without using a password. If you forgot the password or don't know what it is, you can reset it as follows:

  1. Kill the current mysql process running (do a ps -efc| more) or something and kill anything that says MySQL with kill <process_id>. A better alternative is to try and simply stop the process gracefully with rcmysql stop
  2. Create a file (ideally in a directory that only root can read) called init.txt with the following text:

    UPDATE mysql.user SET Password=PASSWORD('NewPassword') WHERE User='root'; FLUSH PRIVILEGES;

  3. Launch MySQL in safe mode and passing the init.txt file as parameter as so:

    mysqld_safe --init-file=mysql-init.txt &
    

Now you can kill MySQL once again and restart the service normally (I think Suse uses rcmysql start:

rcmysql start

Connect to the server as you'd normarlly do with:

mysql -u root@localhost -p

Enter the password you specified in the init.txt file and you should be good to go. DELETE the init.txt file!!!!

2
  • Hello and good day! i will do all you adviced. i come back and report all my findings! Greetings
    – zero
    Mar 13, 2012 at 21:04
  • 2
    DO NOT USE "kill -9"! In worst case you can even destroy your database. Always use just "kill" and check if mySQL dæmon is died within a couple of seconds. If normal kill does not help then only in last resort use flag -9
    – Cougar
    Mar 14, 2012 at 8:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .