Web Hosting Talk







View Full Version : small mysql problem


node9
08-29-2001, 06:40 PM
*sigh*

I"m trying to set a mysql password
according to scripts/mysql_installdb or whatever it says

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
This is done with:
/usr/local/mysql/bin/mysqladmin -u root -p password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h r00tabega.org -p password 'new-password'
See the manual for more instructions.

But no matter what i try i keep getting a stupid error
r00tabega:/home/fresh/mysql-3.23.41# /usr/local/mysql/bin/mysqladmin -u root -p password 'racecar'
Enter password:
/usr/local/mysql/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: YES)'

fusion:/home/fresh/mysql 3.23.41# /usr/local/mysql/bin/mysqladmin -u root -h r00tabega.org -p password 'racecar'
Enter password:
/usr/local/mysql/bin/mysqladmin: connect to server at 'r00tabega.org' failed
error: 'Access denied for user: 'root@localhost' (Using password: YES)'

the server is running i used support-files/mysql.server to start it

node9
08-29-2001, 06:41 PM
cananyone please help me? HOW can i set the mysql pass?

I tried shutting mysql off, then settin the pass, but i still get the same error

Jm4n
08-29-2001, 06:55 PM
Initially mysql's root user has an empty password. The best way to get help is to type 'mysqladmin --help', but for a quick answer:

---
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
---

This logs you in with no password (since there isn't one initially), and sets the password to 'new-password' (substitute your actual desired password here).

When you later want to change it, then you can put the '-p' back in, which tells it to prompt for your old password (or, you can use the '-p' initially and just hit 'enter' when prompted for your password).

Personally I hate how it installs with an empty root password -- you wouldn't believe how many people don't change this...

node9
08-29-2001, 06:59 PM
Does the server hav eto be on ?

Becuase right now its on and i ran what you told me

r00tabega:/home/fresh/mysql-3.23.41# /usr/local/mysql/bin/mysqladmin -u root password 'racecar'
/usr/local/mysql/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: NO)'
r00tabega:/home/fresh/mysql-3.23.41# /usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: NO)'

im still getting errors :(

Jm4n
08-30-2001, 01:17 AM
I'm not sure, but I think the server *should* be running -- I've never shut down my MySQL server except to upgrade MySQL itself.

If you're getting an error, then there *is* a MySQL password set. Did you install MySQL yourself, or was this preinstalled on your machine? If the former, then perhaps one of your previous attempts did work... Otherwise, ask your provider if there was a default password set. I'm pretty sure anyone who preinstalls MySQL would set a default password, especially if the machine is online...

In either case, a password is in fact set and you will need to know it before you can change it.

I was going to recommend replacing your 'user' database with the original that comes with the distribution, but that's probably a bad idea; I don't know what kind of setup the installation does, so your best bet at this point is to probably reinstall MySQL -- after removing it's entire data directory, to make sure it gets replaced.

If you aren't in any hurry, you might scan the documentation or search some mailing list or newsgroup archives; but if you're in a hurry, a reinstall of MySQL might be quicker.

PS -- I'm not sure if it's obvious or not, but in the examples above, where it says "password" -- you actually need to type the word "password" literally. Only the value in single quotes is to be replaced with your desired password.

So assuming you want "foobar" to be your password, you would type exactly:

---
mysqladmin -uroot password 'foobar'
---

The space between "u" and "root" is optional, but not all options give a choice on that. Single quotes can be replaced with double quotes...

At any rate, 'mysqladmin --help' is the best source for the option syntax for any particular version.

mikeknoxv
08-30-2001, 07:01 AM
When you come to the "Enter password:" prompt, just hit enter. Don't retype your password.