Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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)'
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.
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.
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'".
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.
-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.
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
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.
-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.
@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.
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.
- /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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.