LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-04-2008, 02:06 PM   #1
n0p.cracker
Member
 
Registered: May 2008
Location: Croatia
Distribution: slackware 12.1
Posts: 39

Rep: Reputation: 15
mysql problem


ok, i have just installed mysql, after that i have runned command:

Code:
mysql@localhost-n0p:~$ mysql_install_db 
Installing MySQL system tables...
OK
Filling help tables...
OK

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 localhost-n0p password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

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 mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl

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 http://shop.mysql.com
then i have started mysql

Code:
mysql@localhost-n0p:~$ nohup: redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql

mysql@localhost-n0p:~$
then i was going to create password

Code:
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
and there it is đ

what am i doing wrong :S
 
Old 08-04-2008, 03:10 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
I've never actually gotten the mysqladmin command to setup a new password. Try as root just doing a:

mysql -u root -p mysql

And it should let you in since you have no password. Then set up the password manually for root or create another admin type account.

Code:
mysql> use mysql;
mysql> update user set Password = password('newpassword') where User = 'root';
mysql> flush privileges;
 
Old 08-05-2008, 02:37 AM   #3
n0p.cracker
Member
 
Registered: May 2008
Location: Croatia
Distribution: slackware 12.1
Posts: 39

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by trickykid View Post
I've never actually gotten the mysqladmin command to setup a new password. Try as root just doing a:

mysql -u root -p mysql

And it should let you in since you have no password. Then set up the password manually for root or create another admin type account.

Code:
mysql> use mysql;
mysql> update user set Password = password('newpassword') where User = 'root';
mysql> flush privileges;
same error

Code:
 - /home/n0p/ - : mysql -u root -p mysql
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
 
Old 08-05-2008, 09:59 AM   #4
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Don't use -p option; that will prompt for password that does not exist
Code:
mysql mysql -u root
The first mysql is the command, the second is the database to use (so you don't have to issue the command use mysql in mysql). If you're already root, you can also leave the -u root out of the command.
 
Old 08-05-2008, 11:10 AM   #5
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally Posted by Wim Sturkenboom View Post
Don't use -p option; that will prompt for password that does not exist
Code:
mysql mysql -u root
The first mysql is the command, the second is the database to use (so you don't have to issue the command use mysql in mysql). If you're already root, you can also leave the -u root out of the command.
Actually the -p option with a space afterwards specifies the database you want to initially use but yes, with a password. Which the OP claims he reset.

Last edited by trickykid; 08-05-2008 at 11:25 AM.
 
Old 08-05-2008, 11:27 AM   #6
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
Quote:
Actually the -p option with a space afterwards specifies the database you want to initially use.
From "mysql --help":

Code:
-p, --password[=name]
                      Password to use when connecting to server. If password is
                      not given it's asked from the tty.
The -p option means use a password. If you don't supply one on the command line (which you can do) it will prompt you for it.

If you have a root password that you don't know, you can reset it by shutting down mysqld and then running, "mysql.server --skip-grant-tables". You can then run mysql without needing a password. Once in the mysql client, run:

Code:
use mysql;
update user set Password = password("newpass") where User = 'root';
Then stop mysqld again and restart it without the "--skip-grant-tables" option.

HTH

Forrest

edit: to specify the password on the command line you type it directly after the -p with no spaces.

Last edited by forrestt; 08-05-2008 at 02:46 PM. Reason: Added quotes around root in "User = 'root'".
 
Old 08-05-2008, 12:53 PM   #7
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
Quote:
Originally Posted by trickykid View Post
Actually the -p option with a space afterwards specifies the database you want to initially use
I simply suggested to leave the -p option out. Maybe I was not clear enough ?

Quote:
Originally Posted by trickykid View Post
with a password. Which the OP claims he reset.
What I understood is that he wants to set a password. The standard installs that I have seen don't have a password set so don't use the -p option

Last edited by Wim Sturkenboom; 08-05-2008 at 12:54 PM.
 
Old 08-05-2008, 01:43 PM   #8
n0p.cracker
Member
 
Registered: May 2008
Location: Croatia
Distribution: slackware 12.1
Posts: 39

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Wim Sturkenboom View Post
Don't use -p option; that will prompt for password that does not exist
Code:
mysql mysql -u root
The first mysql is the command, the second is the database to use (so you don't have to issue the command use mysql in mysql). If you're already root, you can also leave the -u root out of the command.
same error

Code:
mysql mysql -u root
 
Old 08-05-2008, 01:56 PM   #9
n0p.cracker
Member
 
Registered: May 2008
Location: Croatia
Distribution: slackware 12.1
Posts: 39

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by forrestt View Post
From "mysql --help":

Code:
-p, --password[=name]
                      Password to use when connecting to server. If password is
                      not given it's asked from the tty.
The -p option means use a password. If you don't supply one on the command line (which you can do) it will prompt you for it.

If you have a root password that you don't know, you can reset it by shutting down mysqld and then running, "mysql.server --skip-grant-tables". You can then run mysql without needing a password. Once in the mysql client, run:

Code:
use mysql;
update user set Password = password("newpass") where User = root;
Then stop mysqld again and restart it without the "--skip-grant-tables" option.

HTH

Forrest

edit: to specify the password on the command line you type it directly after the -p with no spaces.
here is another problem, when i start mysql:

Code:
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set Password = password("pass") where User = root;
ERROR 1054 (42S22): Unknown column 'root' in 'where clause'

Last edited by n0p.cracker; 08-06-2008 at 05:14 AM.
 
Old 08-05-2008, 02:45 PM   #10
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
Doh, sorry. That should be:

Code:
update user set Password = password("pass") where User = 'root';
(There should be quotes)

HTH

Forrest

Last edited by jtshaw; 08-16-2008 at 10:49 AM. Reason: edited password...
 
Old 08-05-2008, 08:42 PM   #11
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally Posted by Wim Sturkenboom View Post
I simply suggested to leave the -p option out. Maybe I was not clear enough ?
You were clear, but the op tried to set a password and was testing it, so why would he use no password when he attempted to create one and then run with the -p option?

Quote:
Originally Posted by Wim Sturkenboom View Post
What I understood is that he wants to set a password. The standard installs that I have seen don't have a password set so don't use the -p option
Like mentioned before, if you noticed he ran the command to create a password, it clearly didn't work given his response. That's why he was using the -p option.
 
Old 08-05-2008, 08:46 PM   #12
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally Posted by forrestt View Post
From "mysql --help":

Code:
-p, --password[=name]
                      Password to use when connecting to server. If password is
                      not given it's asked from the tty.
The -p option means use a password. If you don't supply one on the command line (which you can do) it will prompt you for it.
You didn't fully quote me. I was trying to explain to Wim Sturkenboom that using the -p with a space and then a database name specifies the database he wants to initially use after it prompts for the password. -p is safer than specifying --password=<password> as it won't show up in plain text in the users mysql history.
 
Old 08-06-2008, 12:44 AM   #13
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

Rep: Reputation: 282Reputation: 282Reputation: 282
@n0p.cracker
From post #9 I understand that you managed to get in. Can you explain how as that would make the post useful for other users with the same problem.

@trickykid
I indeed overlooked the first attempt using mysqladmin at the end of post #1 (I assume you were referring to that). And I know what -p with a space after it does.
 
Old 08-06-2008, 08:26 AM   #14
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
Quote:
Originally Posted by trickykid View Post
You didn't fully quote me. I was trying to explain to Wim Sturkenboom that using the -p with a space and then a database name specifies the database he wants to initially use after it prompts for the password. -p is safer than specifying --password=<password> as it won't show up in plain text in the users mysql history.
I guess it just wasn't clear from what you wrote that the -p wasn't needed to specify the database. The -p has nothing to do with specifying a database name. It is just a parameter to tell the mysql client to use password authentication. You can specify this on the command line in two ways, "-ppassword" or "--password=password". If you don't specify a password on the command line, the client will prompt you for one. There is no difference between "-p" and "--password". If you want to specify a database on the command line, just add it to the end of your options list. This may include -p, but it doesn't have to.

Just trying to clear things up for those that read this thread later.

Forrest
 
Old 08-06-2008, 08:32 AM   #15
n0p.cracker
Member
 
Registered: May 2008
Location: Croatia
Distribution: slackware 12.1
Posts: 39

Original Poster
Rep: Reputation: 15
ok, i have done that too:

Code:
 - /home/n0p/ - : mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.51b Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> update user set Password = password("rutLinuZZer4.2") where User = 'root';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 0  Changed: 0  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
in phpmyadmin
Code:
Documentation
#1045 - Access denied for user 'root'@'localhost' (using password: NO)

Last edited by n0p.cracker; 08-06-2008 at 03:24 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bugzilla - MySQL - perl - DBD::mysql install problem amchargue Linux - Software 3 09-10-2008 12:01 AM
Problem Starting MySQL on Fresh Fedora 8 Install w/ Yum'd MySQL blong4life Linux - Server 2 07-04-2008 07:44 PM
Bugzilla - MySQL - perl - DBD::mysql install problem Runningonair Linux - Software 8 10-12-2007 12:42 AM
php-mysql dependancy problem after nitemare mysql upgrade. RHEL4 andrewc Red Hat 1 01-03-2006 04:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration