0

To install I did:

yum --enablerepo=remi,remi-test install mysql mysql-server

Result of the last 3 lines:

Installed:
 mysql-server.x86_64 0:5.0.95-5.el5_9

Complete!

Then I did the following:

[root@resdb-1 mysql]# /etc/init.d/mysqld start
Starting mysqld:                                          [  OK  ]

Then I do the following:

[root@resdb-1 mysql]# /usr/bin/mysql_secure_installation




NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
  SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!


In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): **(I PRESSED ENTER HERE)**
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

For the life of me I cannot set a password for root, I've tried everything I found on the web, doing it by using mysqladmin -u root password NEWPASSWORD, I always get the same message each and every time (sometimes it's 'using password: yes'): ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

I even managed to stop the service, hop into mysql -u root and set using sql command, but it still doesn't work, nothing changes.

What am I doing wrong here?

EDIT:

I tried the following without any luck:

[root@resdb-1 mysqld]# kill `cat /var/run/mysqld/mysqld.pid`
[root@resdb-1 mysqld]# mysqld_safe --init-file=/home/maddock/mysql-init &
[3] 20961
[root@resdb-1 mysqld]# Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/run/mysqld/mysqld.pid
140129 20:32:00  mysqld ended


[3]-  Done                    mysqld_safe --init-file=/home/maddock/mysql-init
[root@resdb-1 mysqld]# /sbin/service mysqld start
Starting mysqld:                                          [  OK  ]
[root@resdb-1 mysqld]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@resdb-1 mysqld]#

EDIT 2:

This here contains the command to reset the password: /home/maddock/mysql-init contents:

UPDATE mysql.user SET Password=PASSWORD('testpass') WHERE User='root';
FLUSH PRIVILEGES;
Maddock
  • 3
  • 1
  • 3
  • 1
    Was this an update/install over the top of an existing instance? – tink Jan 29 '14 at 21:07
  • No, I did a new one, then I uninstalled using the method listed here: http://serverfault.com/questions/74125/how-do-i-completely-remove-mysql-from-a-linux-installation I just can't get it to work :( – Maddock Jan 29 '14 at 21:13
  • Out of curiosity: what made you chose & install an ancient version of mysql from a foreign repo, rather than a current one from the distro's repos? – tink Jan 29 '14 at 21:21
  • Ok, how do I do that? I'm oblivious to the linux environment, everything I'm doing I'm following google's instruction. – Maddock Jan 29 '14 at 21:33
  • Ugh ... I totally overlooked the actual version of your centos install. 5.8? It's deprecated - why are you still on that? :) – tink Jan 29 '14 at 21:41
  • I have no idea, I ordered a virtual server and it was either that or an expensive Windows Server. All I need is a running mysql server, nothing else. I won't even be running commands on it, our app will do that. I just need root access. – Maddock Jan 29 '14 at 21:44
  • You can change the MySQL root password using the --init-file method described here: http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html . Also agree that you are making it complicated by not using the distro repo – HTTP500 Jan 29 '14 at 22:12
  • I followed the instructions word for word, everything went as it should, no errors. I started the service and when I try to login still getting the dreaded message: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) – Maddock Jan 29 '14 at 22:30
  • I edited the post showing how I've done it. – Maddock Jan 29 '14 at 22:37

1 Answers1

3

I think @tink had it right from the start.

An uninstall doesn't delete databases; it deletes the database software.

If you've installed MySQL, configured a root password, uninstalled MySQL and finally installed another version of MySQL your data from the first install is still there.

If it wasn't, imagine how surprised you would be when you upgraded the installed MySQL RPM on a production server. An upgrade is essentially an uninstall, then a new install.

If you truly want to start from scratch, you'll need to delete the existing files by hand. They are typically in /var/lib/mysql on Linux.

If you currently have no MySQL data you need to save and your configuration is left at the default location you should be able to fix it by:

rm -rf /var/lib/mysql/*; mysql_install_db.