LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   mysql inital setup issue (https://www.linuxquestions.org/questions/linux-server-73/mysql-inital-setup-issue-552300/)

madhavr 05-08-2007 11:04 AM

mysql inital setup issue
 
hi ive just installed mysql on fc6 and im getting the following issue

Quote:

[root@localhost ~]# mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
ive tried setting the root password and i still get the same message as above

trickykid 05-08-2007 11:16 AM

Is it even prompting for the password?

mysql -u root -p mysql

jschiwal 05-08-2007 11:32 AM

Try "mysql -u root -p"
It should as for the password then. I think that is to prevent the entering of the root password on the command line, which a user might be able to see looking at the process.

I take it back.
"mysql -u root -p password" won't work, whereas "mysql -u root -ppassword" will.

mysql changes the password argument to hide it, so if you enter the password on the command line, the risk is if someone can print out the cmdline before it is changed.
Code:

cat /proc/28991/cmdline
mysql-uroot-pxxxxxxx

Look in /usr/share/doc/packages/mysql/manual.pdf or manual.ps. There is a chapter on securing mysql after installation.

madhavr 05-08-2007 11:51 AM

hi trickykid it worked i was able to login finally using -p mysql which makes no sense to me as i didnt set this to be the password.

I suspect this might have something to do with this package version being custom to fc6?? as it did say that in the version. however didnt see anything in the docs that pointed out that root was already setup since after installation you get the normal mysql_istall_db spew instructions on setting up the root password etc

trickykid 05-08-2007 12:14 PM

-p mysql is setting the default database to login and use so you don't have to switch databases after logging in. In all cases there's a mysql database on every mysql install. It's just out of habit that I use that to login for the first time cause I'll be making changes to the mysql database.

If you want to specify the password from the command you can do:

mysql -u <username> -p<password> # Notice there is no space after -p

or

mysql -u <username> -p <database> --password=<password>

For security reasons, probably best to make it prompt for the password by just passing a -p.

madhavr 05-08-2007 12:30 PM

thanks for your help trickykid (again) it seems to work fine now and i've assigned password to root using SET PASSWORD command with no issues. :)


All times are GMT -5. The time now is 04:35 PM.