Solved

Put a password on mysql of xampp

Posted on 2009-05-20
10
1,071 Views
Last Modified: 2013-12-13
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
Comment
Question by:gplana
  • 4
  • 2
  • 2
  • +2
10 Comments
 
LVL 14

Assisted Solution

by:shobinsun
shobinsun earned 50 total points
ID: 24430656
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
 
LVL 8

Accepted Solution

by:
yfastud earned 200 total points
ID: 24430781
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
 
LVL 15

Author Comment

by:gplana
ID: 24430792
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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 8

Expert Comment

by:yfastud
ID: 24430793
you also might want to know how to setup db for user account as well ;)
http://blog.jlbn.net/?p=19
0
 
LVL 14

Expert Comment

by:shobinsun
ID: 24430813
Hi,

You can set the password using the same method as I have posted above(If you didnt set any).
0
 
LVL 8

Expert Comment

by:yfastud
ID: 24430837
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
 
LVL 8

Expert Comment

by:yfastud
ID: 24430894
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
 
LVL 26

Assisted Solution

by:ushastry
ushastry earned 50 total points
ID: 24431837
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
 
LVL 2

Assisted Solution

by:miyosia
miyosia earned 200 total points
ID: 24431840
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
 
LVL 15

Author Closing Comment

by:gplana
ID: 31583460
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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Complex MySQL Query 2 33
add new field to OOP code in order to insert into new database column 4 24
issue with DB import 1 17
$_SERVER Variable question 31 27
As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question