• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1098
  • Last Modified:

Put a password on mysql of xampp

I'm running xampp on a linux server with some php applications running over MySQL.

Actually MySQL has the security disable (root password is not set). We want to change that assigning a password to root mysql user.

Can anybody show me how can I put a password for accessing mysql for enabling its security ?

Thank you very much.
0
gplana
Asked:
gplana
  • 4
  • 2
  • 2
  • +2
4 Solutions
 
shobinsunCommented:
Hi,

   1. Stop the mysqld daemon process.
   2. Start the mysqld daemon process with the --skip-grant-tables option.
   3. Start the mysql client with the -u root option.
   4. Execute the UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
   5. Execute the FLUSH PRIVILEGES; command.

For more about that:

http://www.mydigitallife.info/2006/06/06/change-and-reset-mysql-root-password/

0
 
yfastudCommented:
this guide is used for wampserver but should work for xampp as well, just make sure to open correct file in proper location ;)
http://blog.jlbn.net/?p=17
0
 
gplanaAuthor Commented:
Thank you for your answer.

Hiowever, this article explains to change password in case it's forgotten. This is not my case. My case is that MySQL is installed without any security password, so I enter without putting a password.

Can I set the password just by typing some SQL statement inside mysql client ?
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
yfastudCommented:
you also might want to know how to setup db for user account as well ;)
http://blog.jlbn.net/?p=19
0
 
shobinsunCommented:
Hi,

You can set the password using the same method as I have posted above(If you didnt set any).
0
 
yfastudCommented:
if you address my answer, no, it's for setting up password when you first install wamp package such as wampserver, xampp, so on ;)
0
 
yfastudCommented:
Quote "Can I set the password just by typing some SQL statement inside mysql client ?"
Yes, you can just as shobinsun posted but then you might have problem to use phpmyadmin to manage your db ;)
0
 
UmeshMySQL Principle Technical Support EngineerCommented:
Simply run this command and your root password would be set..  when it is prompted for password simply press enter..you new password is set..
mysqladmin -uroot -p password newpassword
 
 
Once the above step is done... for securoty reasons delete those accounts whose password is not set...

Open in new window

0
 
miyosiaCommented:
if you are using xampp you can configure security through this link http://localhost/security/index.php you need to have the apache and mysql running to be able to setup security for each installed components.
0
 
gplanaAuthor Commented:
Thank you very much to all. I think miyosia and yfastud are good solutions for me, as it will not just change MySQL password, but also configure phpmyadmin with new password.

However, shobinson and ushastry solutions can be useful too for changing mysql password.

Thank you all !!!
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 4
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now