View previous topic :: View next topic |
Author |
Message |
elkhunter Tux's lil' helper
Joined: 19 Sep 2004 Posts: 138
|
Posted: Fri Apr 21, 2006 2:12 am Post subject: new mysql install gives access denied |
|
|
I'm trying to do a fresh (conrad) gentoo install for a mythtv box and am having mysql problems. I emerged mysql (5.0.19-r1), then ran:
/etc/init.d/mysql start
/usr/bin/mysql_install_db
then according to the instructions from the database install I tried:
/usr/bin/mysqladmin -u root password 'new-password'
but it always returns:
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
What am I doing wrong (and is there any way to use mysql w/o all this ridiculous security (I'm already root -- why do I need a stupid password anyway)?
Thanks in advance. |
|
Back to top |
|
|
gerene n00b
Joined: 18 Oct 2005 Posts: 37 Location: Belgium
|
Posted: Fri Apr 21, 2006 7:25 am Post subject: |
|
|
The command Code: | mysqladmin -u root password newpassword | is to set a password for the database.
If you skip this you can use mysql without a password. However, everybody can then access this database without password.
MySQL passwords and Linux passwords are 2 different kind of animals. _________________ Jan Gerene |
|
Back to top |
|
|
elkhunter Tux's lil' helper
Joined: 19 Sep 2004 Posts: 138
|
Posted: Fri Apr 21, 2006 2:36 pm Post subject: |
|
|
But after a fresh install I was unable to set the password (see original post). It gave me access denied from the first time I tried to use it. I didn't run into this problem when I setup mysql before (about 2 years ago or so). I dont have any problem running the database w/o a password (it's a isolated network and even if someone broke in what are they going to steal -- my tv schedules?). However I can't even access it to get things setup. Is there a mysql password file (or equiv) somewhere that I can simply wipe out as root? |
|
Back to top |
|
|
keyson l33t
Joined: 10 Jun 2003 Posts: 830 Location: Sweden
|
Posted: Fri Apr 21, 2006 3:11 pm Post subject: |
|
|
To me it don't look like a 'fresh' install. If you could run
Code: | /etc/init.d/mysql start |
And it don't return any error.
Normaly you have to run the db script
Code: | /usr/bin/mysql_install_db |
before you can start it.
So you have old databases left on the computer. Try remember the old password
or delete the database library and rerun the mysql_install_db script
before you try to set the password with the mysqladmin.
EDIT: The databases is located in /var/lib/mysql.
The password is stored in the mysql database. So wipe the library and
try again. If you don't have any databases that you must save. |
|
Back to top |
|
|
elkhunter Tux's lil' helper
Joined: 19 Sep 2004 Posts: 138
|
Posted: Sat Apr 22, 2006 2:40 am Post subject: |
|
|
This is a completely install (seperate freshly formatted partition). I tried starting the service before creating the database as I was following the gentoo/mythtv instructions at: http://home.comcast.net/~alf_park/mythtv.html
I just performed the following steps to try and get it working:
/etc/init.d/mysql stop
rm -rf /var/lib/mysql
rm -rf /etc/mysql/
emerge mysql
mysql_install_db
/etc/init.d/mysql start
mysqladmin -u root password mythtv
But I still get the access denied message. The following shows the full transcript after the emerge:
>>> dev-db/mysql-5.0.19-r1 merged.
>>> No packages selected for removal by clean.
>>> Auto-cleaning packages...
>>> No outdated packages were found on your system.
* GNU info directory index is up-to-date.
mythtv1 lib # mysql_install_db
Installing all prepared tables
Fill help tables
To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h mythtv1 password 'new-password'
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at https://order.mysql.com
mythtv1 lib # /etc/init.d/mysql start
* Caching service dependencies ... [ ok ]
* ...
* Starting mysql (/etc/mysql/my.cnf) [ ok ]
mythtv1 lib # mysqladmin -u root password mythtv
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
What am I doing wrong? I ran into similar problems a month or two ago when I tried upgraded my old myth box and finally just gave up and decided to re-install but I'm still fighting mysql. Did something else change in mysql 5 that the above instructions are no longer valid? |
|
Back to top |
|
|
kg n00b
Joined: 17 May 2003 Posts: 55 Location: Not where I want to be
|
Posted: Sat Apr 22, 2006 6:21 pm Post subject: |
|
|
Is mysql-5.0.19 really the current version in portage? Or are you using masked packages?
(Just out of curiosity. I see mysql-4.1.14-r1 as the current version--just did emerge sync yesterday).
Perhaps something has changed in 4.1 -> 5.0 about that particular command?
At any rate, it fails when you try to use mysqladmin to set a password. What happens if you just try to login
without a password?
Does that work?
If it does, you can just set your password for user root
Code: | mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
mysql> SET PASSWORD FOR 'root'@'%' = PASSWORD('newpwd'); |
_________________ If at first you don't succeed, try again. Then quit. No use being a damn fool about it. --W.C. Fields |
|
Back to top |
|
|
elkhunter Tux's lil' helper
Joined: 19 Sep 2004 Posts: 138
|
Posted: Sat Apr 22, 2006 11:18 pm Post subject: |
|
|
That didn't work either. I get the same error (see below).
mythtv1 ~ # mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
mythtv1 ~ # netstat -a | grep sql
tcp 0 0 localhost:mysql *:* LISTEN
unix 2 [ ACC ] STREAM LISTENING 46751 /var/run/mysqld/mysqld.sock
I dont know if mysql is really storing the password somewhere else other than the directory I wiped out or if this version is just plain broken. Regarding 5.0.19, I'm not sure why it's picking up that version. I'm using ~x86 but dont have it listed in any file in /etc/portage (nor under my overlay at /usr/local/portage).
I'm starting to wonder if this is maybe a problem with mysql 5 and the conrad install (eg - gcc 4.1 & glibc 2.4). I need to figure out how to turn on debug in mysql and see if I can tell why its failing...
Thanks again. |
|
Back to top |
|
|
elkhunter Tux's lil' helper
Joined: 19 Sep 2004 Posts: 138
|
Posted: Sun Apr 23, 2006 12:50 am Post subject: |
|
|
Finally solved it. I followed a seperate post on how to reset the password (even though I was never able to set it) by doing the following:
Add skip-grant-tables to /etc/mysql/my.cnf
/etc/init.d/mysqld restart
mysql -u root -h localhost mysql
update user set password = password('mythtv') where user='root';
quit
Now it works fine and I can login to the database. |
|
Back to top |
|
|
|