Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Wednesday, December 19, 2012

How to change the ‘root’ password for MySQL in XAMPP?

By default, when you install XAMPP in your windows machine, the ‘root’ password for the MySQL is set to empty. But this is not recommended, as the MySQL database without a password will be accessible to everyone. To avoid this, a proper/secure password must be set to the user ‘root‘. To do it in XAMPP, there are two ways.


Method 1: 

Reset XAMPP MySQL root password through web interface: After you started your XAMPP server, go to the browser and type the URL http://localhost/security/ (incase you’ve modified XAMPP server port, you need to include that port number also in previous URL). The security page will be shown where you can change the ‘root’ password for MySQL. This will update the phpMyAdmin config also.


Method 2: reset XAMPP MySQL root password through SQL update

  1. Start the Apache Server and MySQL instances from the XAMPP control panel.
  2. After the server started, open any web browser and givehttp://localhost:8090/phpmyadmin/ (if you are running XAMPP on 8090 port). This will open the phpMyAdmin interface. Using this interface we can manager the MySQL server from the web browser.
  3. In the phpMyAdmin window, select SQL tab from the right panel. This will open the SQL tab where we can run the SQL queries.
  4. Now type the following query in the textarea and click Go
    UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
    FLUSH PRIVILEGES;
  5. Now you will see a message saying that the query has been executed successfully.
  6. If you refresh the page, you will be getting a error message. This is because the phpMyAdmin configuration file is not aware of our newly set root passoword. To do this we have to modify the phpMyAdmin config file.
  7. Open the file [XAMPP Installation Path] / phpmyadmin / config.inc.php in your favorite text editor.
  8. Search for the string $cfg['Servers'][$i]['password'] = ”; and change it to like this, $cfg['Servers'][$i]['password'] = ‘password’; Here the ‘password’ is what we set to the ‘root’ user using the SQL query.
  9. Now all set to go. Save the config.inc.php file and restart the XAMPP server.

references : http://veerasundar.com/blog/2009/01/how-to-change-the-root-password-for-mysql-in-xampp/



PS : Some initializing information when run :/opt/lampp/lampp security

XAMPP:  Quick security check...
XAMPP:  Your XAMPP pages are NOT secured by a password.
XAMPP: Do you want to set a password? [yes]
XAMPP: Password:
XAMPP: Password (again):
XAMPP:  Password protection active. Please use 'xampp' as user name!
XAMPP:  MySQL is accessable via network.
XAMPP: Normaly that's not recommended. Do you want me to turn it off? [yes]
XAMPP:  Turned off.
XAMPP:  MySQL has to run before I can check the security.
XAMPP:  MySQL has to run before I can check the security.
XAMPP:  MySQL has a root passwort set. Fine! :)
XAMPP:  The FTP password for user 'daemon' is still set to 'xampp'.
XAMPP: Do you want to change the password? [yes]
XAMPP: Password:
XAMPP: Password (again):
XAMPP: Reload ProFTPD...not running.
XAMPP:  Done.


Tuesday, December 18, 2012

Cài đặt XAMMP trên LINUX với NOMAL USER

Bước 1 : Sau khi cài đặt chúng ta chuyển đến folder chứa LAMMP :

#cd /opt/lampp/

Liệt kê danh sách file trong thư mục gốc của LAMMP :


Nhiệm vụ được đặt ra là đổi nobody thành tên username của chúng ta :

Bước 2 : Cần phải xác định được username mà chúng ta đang sử dụng là gì :

#whoami

Xác định user-name đang sử dụng thuộc group nào :

#goups



như hình trên ta có user-name : vanduc1102 thuộc về 2 group là root và db2iadm1

Bước 3: Cấp quyền sử dụng cho thư mục  htdocs


Bước 4 :

mở file httpd.conf trong /opt/lammp/etc/


# gedit /opt/lampp/etc/httpd.conf 



xem đoạn

User nobody

Group nogroup

</IfModule>

</IfModule>


Và đổi thành

User vanduc1102

Group nogroup

</IfModule>

</IfModule>




Khởi động lại lammp là ok .
#/opt/lammp/lammp start