MySQL problem

Hello I just started and I was using FreeBSD so I'm new to this and I came across an error that I think is from MySQL.
Code:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Can you help me to solve some? Sorry for my English which is kind of weak but are ethnic FR [size=-1][FR undoubtedly means something, but no idea what -- Mod.][/size].
 
I came across this error not too long ago when I was setting up MySQL. I'm pretty sure, it's telling you that you need to set a password for the root user on MySQL. It denies your login because there's no password for the root user.
 
I forgot to mention how to set your root password for the first time (I'm assuming you've never set the root password before).

mysqladmin -u root password typeyourpasswordhere
Replace "typeyourpasswordhere" with whatever you wish.
 
When you say you came across this error, do you mean you're trying to use MySQL and get that error, or you've found it in one of the logs? That error basically means someone tried to access MySQL from the local computer (as root) and didn't provide a password. (It looks like a password has already been set)

If you're trying to access MySQL, and you know the password, run mysql -p. The -p tells it to ask you for the password. If you provide the wrong password you'll get the same error, but it'll say (using password: yes) on the end.
 
Apart from what the others have said; keep in mind that in general you do not want to use MySQL using its root account. If you need another service (a website for example) to have access to a MySQL database then create that database and an associated database account to be used. Then grant the new account access to this database and from there on use that specific account when you need to access the new database.

Something in the likes of:

Code:
smtp2:/home/peter $ mysql -u root -p
Enter password:
Your MySQL connection id is 5514
Server version: 5.1.71 FreeBSD port: mysql-server-5.1.71

mysql> create database newdatabase;
Query OK, 1 row affected (0.01 sec)

mysql> grant all on newdatabase.* to newuser@localhost identified by 'password';
Query OK, 0 rows affected (0.00 sec)
You can probably also do some of these things using the mysqladmin command but I never bother with that stuff myself, the commandline works just as easy for me.

Here I basically created a database called newdatabase, a user called newuser@localhost (meaning so much that this account can only access the MySQL server when on the same server) and finally I gave it the password "password" (which is a very bad idea).

For more information on this subject please check out Chapter 6.3 of the MySQL manual; this explains all there is to know regarding account management.
 
When I write mysql -p gives me using password yes. Can someone help me in solving the problem, some steps are a beginner.
 
[size=-1]Sloved im using this .[/size]
Solved. I'm using this:
# /usr/local/etc/rc.d/mysql-server stop
# /etc/rc.d/init.d/mysql stop
# mysqld_safe --skip-grant-tables &
# mysql -u root
[size=-1]And .[/size]
and:
Code:
> use mysql;
update user set password=PASSWORD("PAROLA_NOUA") where User='root';
flush privileges;
quit

# /usr/local/etc/rc.d/mysql-server stop
# /usr/local/etc/rc.d/mysql-server start
[size=-1]And to test if it works after I put .
[code]mysql -u root -p[/code]
And it works not give me this error .
[/size]

To test if it works, after that I do mysql -u root -p. It works and does not give me this error:
Code:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Thank you all for your help.
 
So, you were basically asking how to reset the root password for MySQL?
 
I have the same error message. Strangely, I now can log in using phpmyadmin, but the command line does not work.

I had preciously tried to reset the password by using no grant tables, and then added a root password.

Code:
root@cone:/home/hg # mysql -u root mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
root@cone:/home/hg # mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
 
Back
Top