How can I change MySQL password via MY.INI file?

Problems with the Windows version of XAMPP, questions, comments, and anything related.

How can I change MySQL password via MY.INI file?

Postby hkBattousai » 20. September 2009 20:56

I searched this forum with keywords "mysql", "change" and "password" and couldn't find any relevant topic. If this was asked before please forgive me.

My my.ini file:
Code: Select all
# Example MySQL config file for medium systems.
#
# This is for a system with little memory (32M - 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is @localstatedir@) or
# ~/.my.cnf to set user-specific options.
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
# The following options will be passed to all MySQL clients
[client]
#user       = root
#password   = secret
host        = .
port      = 3306
socket      = "MySQL"


I get the following message when I try to connect the MySQL server:
Code: Select all
mysql.exe -hlocalhost -uroot -psecret
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

  1. There is no ".../etc/" directory in my system. You couldn't mean ".../php/ext/" folder, could you...?
  2. I renamed "my.ini" file and copied it to ".../mysql/data/" folder as the commented section instructs. But still can not connect to the MySQL server.
  3. Do I have to change the line "host = .". I tried writing "127.0.0.1" instead of "." but nothing changed.

What am I doing wrong here?
I'm new to Xampp, any help will be appreciated.
User avatar
hkBattousai
 
Posts: 5
Joined: 20. September 2009 20:24

Re: How can I change MySQL password via MY.INI file?

Postby Wiedmann » 20. September 2009 21:25

How can I change MySQL password via MY.INI file?

Not possible.
--> MySQL users and passwords are stored in the database and not in an INI file.
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: How can I change MySQL password via MY.INI file?

Postby hkBattousai » 20. September 2009 21:48

Hmm, I understand, so how can I change that database entry? We used to use a configuration wizard in in old conventional MySQL. Does anything like that exist?
User avatar
hkBattousai
 
Posts: 5
Joined: 20. September 2009 20:24

Re: How can I change MySQL password via MY.INI file?

Postby Wiedmann » 21. September 2009 01:13

Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Re: How can I change MySQL password via MY.INI file?

Postby Gadrin » 21. September 2009 01:23

hkBattousai wrote:
Code: Select all
[client]
#user       = root
#password   = secret
host        = .
port      = 3306
socket      = "MySQL"


[list=1]
[*]There is no ".../etc/" directory in my system. You couldn't mean ".../php/ext/" folder, could you...?
[*]I renamed "my.ini" file and copied it to ".../mysql/data/" folder as the commented section instructs. But still can not connect to the MySQL server.



Let's see, first remove the # on those lines, otherwise they're treated as comments and ignored.

Best place to see where MySQL is looking for a .cnf or .ini is to look at the MySQL Service command line (in the control panel). If it's using
a startup file it should show you there the path to that file.

If it isn't then look in the manual, there's a few other places it will look on Windows. Look under
Chapter 4.2.3.2. Using Option Files


If you're talking about changing the password to a new password, that's completely different. You probably
need to login as root and change it for the user, if you have the access.

Code: Select all
SET PASSWORD FOR 'abe'@'host_name' = PASSWORD('eagle');
FLUSH PRIVILEGES;


>
Gadrin
 
Posts: 27
Joined: 08. April 2009 23:43

Re: How can I change MySQL password via MY.INI file?

Postby hkBattousai » 21. September 2009 11:08

Thank you very much for you helps.
I used localhost/security interface to change the password. It is better, since it changes PHPMyAdmin password as well.
User avatar
hkBattousai
 
Posts: 5
Joined: 20. September 2009 20:24


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 46 guests