#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2008
    Posts
    62
    Rep Power
    6

    How to get my database connection to work using XAMPP


    hi i have installed XAMPP and its got php and apache working fine but mysql does not work i get the error:

    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: YES) in C:\xampp\htdocs\testDB.php on line 5
    couldn't connect localhost

    i have not configured anything for the database, because i don'nt know how to using XAMPP?
    how do I even create a database using XAMPP?
  2. #2
  3. No Profile Picture
    Super Moderator
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Posts
    4,008
    Rep Power
    2791
    Originally Posted by http://www.apachefriends.org/en/xampp-windows.html#530
    * XAMPP and services
    For all NT/2000 users, in both packages you will find the install and uninstall files to build all servers as services in the respective directories.

    * apache_installservice.bat => Apache install as service/li>
    * apache_uninstallservice.bat => Apache uninstall as service
    * mysql_installservice.bat => MySQL install as service
    * mysql_uninstallservice.bat => MySQL uninstall as service

    After all changes don't forget to restart your system. Note! To uninstall the mysql service you must first of all have stopped the mysql service!
    * MySQL and PHP
    MySQL starts without a password for "root". So in PHP you can connect the MySQL-Server with: mysql_connect("localhost","root","");
    If you want to set a password for "root" in MySQL, please use "mysqladmin" under Console. For example:

    \...\xampp\mysql\bin\mysqladmin -u root password secret

    Attention. After changing the password for root, don't forget to inform PHPMyAdmin. Search the "config.inc.php" under \...\xampp\phpmyadmin\ and edit the following lines:

    $cfg['Servers'][$i]['user'] = 'root'; // MySQL SuperUser
    $cfg['Servers'][$i]['auth_type'] = 'http'; // HTTP MySQL authentification

    Now the correct password for "root" is required, before PHPMyAdmin starts.

    Please see also the three methods in the Windows FAQ:
    http://www.apachefriends.org/en/faq-...html#password0
    Do your research next time. This was a 10 second google

    MySQL default installation does not come with a password set.
    [PHP] | [Perl] | [Python] | [Java] != [JavaScript] | [XML] | [ANSI C] | [C++] | [LUA] | [MySQL] | [FirebirdSQL] | [PostgreSQL] | [HTML] | [XHTML] | [CSS]

    W3Fools - A W3Schools Intervention.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2009
    Posts
    5
    Rep Power
    0
    Hello,

    Uninstall it and then reinstall it, it could be because of the installation error.


    Regards,
    sarah_9



    infoseeksoftwaresystems.com/

    Comments on this post

    • Winters disagrees : XAMPP is not something that is installed and that is not an installation error.

IMN logo majestic logo threadwatch logo seochat tools logo