MySQL Root & Password

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply

Am I a newb or what?

Yes
5
100%
No
0
No votes
 
Total votes: 5

User avatar
soundbwoy
Forum Newbie
Posts: 21
Joined: Sat Jun 07, 2003 5:22 pm
Location: Orlando, FL

MySQL Root & Password

Post by soundbwoy »

OK I set up MySQL and then ran winmysqladmin right away and it created my new .ini file and I entered in Username & password I used:

username: "root"
Pasword: "MyPassword"

Now when I try and get in using MySQL Promt:
mysql -u root -p
PASSWORD: MyPassword

It denies me access But if I do the same thing and just hit enter when the password comes up I get in. How do I make it always ask me for password? Why do I have to leave the password off?

I even checked my my.ini file and the password I entered is there? Whats going on?
yamokosk
Forum Newbie
Posts: 16
Joined: Wed Jun 04, 2003 2:35 pm

depends

Post by yamokosk »

I believe that it depends on where you are connecting to your DB, either from localhost or not. And you can set the password for each. So you can have:

root@localhost -> no passwd
root@* (from anywhere else) -> Mypasswd

So i would guess that there is no password set for root@localhost? But then I am also not an expert.

You said you have a windows machine? Download and install the mySQL Control Center from mysql.com. It adds a nice graphical interface to mysql. Or phpmyadmin is also really really good if you have php up and running.
User avatar
soundbwoy
Forum Newbie
Posts: 21
Joined: Sat Jun 07, 2003 5:22 pm
Location: Orlando, FL

Post by soundbwoy »

Yeah I guess I just need to specify @localhost when I create the user & pass?

I know about MySQLCC & PHPMAdmin, Im actually writing a tutorial on installing PHP & MySQL, but can't figure out why it doesn't use my password i sepcified using winmysqladmin. Just trying to find out how to set up user & pass without using MySQLCC or PHPMyAdmin. From commad line right when I get done installling.
User avatar
soundbwoy
Forum Newbie
Posts: 21
Joined: Sat Jun 07, 2003 5:22 pm
Location: Orlando, FL

Post by soundbwoy »

Still trying to figure out how to set up root@localhost so that when I log into MySQL Prompt it asks me for a password. I need to know how to do it in Command Line.
User avatar
soundbwoy
Forum Newbie
Posts: 21
Joined: Sat Jun 07, 2003 5:22 pm
Location: Orlando, FL

Post by soundbwoy »

Here we go. Once you install MySQL the first thing you should do is set the root@localhost password, because it is the one used when logging into MySQL Prompt using root. Correct me if Im wrong..

mysql> SET PASSWORD FOR root@localhost=PASSWORD('rubberchicken');

Otherwise you won't have to use a password to get into MySQL. Im still confused as to what the other root is for and why winmysqladmin asked me to change the password when I launched it. Right after installing. So the password that is in you my.ini file is not necessarily the pasword for root? Please help me understand someone.
Post Reply