views:

134

answers:

3

I'm new to mysql, I'm trying to run Wordpress inmy windows desktop and it need Mysql.

I install everything with Web Platform Installer which provided by microsoft. I never seta root password for mysql and in final step of installing wordpressit askfor root password of mysql.

What is the default password for root (if there is one) and how to change it?

I try

mysql -u root password '123'

but it show me

Access denied for user 'root@localhost' (using password:NO)

after this I try

mysql -u root -p

but it ask for a password which I don't have

Thank you in advance


Update : as Bozho said I did the following

 1 - I stoped MySql Service from Windows services
 2 - Open CMD
 3 - change location to cd c:\program files\mysql\bin
 4 - write this command

 mysqld --defaults-file="C:\\program files\\mysql\\mysql server 5.1\\my.ini" --init-files=C:\\root.txt

 5 - Command run with a warning about characterset which I mentioned below
 6 - I start MySql Service from windows services
 7 - in command line I write

mysql -u root -p
EnterPassword: 123  // 123 was the password

8 - the commandline shows following bug

Access denied for user 'root@localhost' (using password:**YES**)

I'm waiting to hear from you.

+1  A: 

You can reset your root password. Have in mind that it is not advisable to use root without password.

Bozho
@Bozho - I follow the instruction aand create a text file and call it from the mentioned command, after that I face with `100608 [warning] --default-character-set is deprecated and will be removed in a future release. please use --character-set-server instead` .-------------------------------- and finally when I start my mysql service again I face withthe exact error but this time with `(using password:yes)` what should I do?
Nasser Hadjloo
@Bozo - Note that I couldn't run your command with `mysqldt-nt` I run it by `mysqldt -nt` Actuallythe first one is not recognizable for cmd. I'm waiting to hear from you.
Nasser Hadjloo
is it MySQL 5.0 or 5.1?
Bozho
@Bozho - MySql 5.1
Nasser Hadjloo
then http://dev.mysql.com/doc/refman/5.1/en/resetting-permissions.html :)
Bozho
@Bozho - I've update my question with the bug. thank you for your time.
Nasser Hadjloo
+1  A: 

Make sure the MySQL service is running on your machine, then follow the instructions from MySQL for initially setting up root (search for 'windows' and it will take you to the steps for setting up root):

http://dev.mysql.com/doc/refman/5.1/en/default-privileges.html

gnucom
@gnucom - This solution wont work for me because i don't have the password which it need in second step.
Nasser Hadjloo
This is what I was looking at when I sent the link, are you sure this doesn't work? I don't see any reference to the old password.For Windows, do this:shell> mysql -u rootmysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');mysql> SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('newpwd');mysql> SET PASSWORD FOR 'root'@'%' = PASSWORD('newpwd');
gnucom
@gnucom - As I told before when I write `mysql -u root` I face with problem and I can not login to mysql to run second line. so How to use this command?
Nasser Hadjloo
+1  A: 

Try resetting mysql root password.

~Umesh

Umesh
@Umesh - I went to `mysql\bin` and it tellme that `update is not recognaised as an internal or external command` then I try to use `mysql` command and then pressing enter then I face with `same roor but this time instead of root @localhost I see Access denied for ODBC@localhost` what should I do?
Nasser Hadjloo