Results 1 to 4 of 4

Thread: Problem connecting to mysql db

  1. #1
    Join Date
    Dec 2008
    Posts
    69

    Problem connecting to mysql db

    hi,
    I need more pages to access the db. Currently, in every page I have specified the variables needed for the connection, like this:
    $ host = 'localhost';
    $ db_user = 'root';
    $ pass = 'root';
    $ database = 'db_pro';

    However, if for example you change the password to access the db should go to each page to change this value. I tried to create a file containing connection.php these variables and then calling this file in the pages where I need using the require, but it seems not work. How can I do?

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Problem connecting to mysql db

    I need more pages to access the db. Currently, in every page I have specified the variables needed for the connection, like this:
    $ host = 'localhost';
    $ db_user = 'root';
    $ pass = 'root';
    $ database = 'db_pro';

    However, if for example you change the password to access the db should go to each page to change this value. I tried to create a file containing connection.php these variables and then calling this file in the pages where I need using the require, but it seems not work. How can I do?
    In what sense does not seem to work? If it is called right initialization should be able to connect normally and solve the problem. What you did is right, it remains to understand why it does not work.

    Error that you reported?

  3. #3
    Join Date
    May 2008
    Posts
    2,389

    Re: Problem connecting to mysql db

    hi,
    mysql supports SSL. Did you check your server's logfiles? most implementations try a private key, then revert to password authentication. Starting the server in "verbose" mode also might enlighten you.

  4. #4
    Join Date
    May 2008
    Posts
    2,297

    Re: Problem connecting to mysql db

    creates a file called type connection.php
    <? php
    $ host = 'localhost';
    $ db_user = 'root';
    $ pass = 'root';
    $ database = 'db_prova';
    >

    then all of your file instead of rewriting these lines, for example in the index.php file type:

    <? php
    include ( "connection.php");

    BODY OF THE PAGE

    >

    Doing so in all your pages, in case you should change the login information (for example if you change your domain or put your code on other web servers) just changing the data in the file only connection.php.

    You could use this method to simplify your pages and to simplify maintenance of the code (eg. A file with only the menus, one with only the header, one with only the footer). One need only recall it from your php page.

Similar Threads

  1. Connecting C# with MySQL database
    By Quattro in forum Software Development
    Replies: 5
    Last Post: 05-03-2010, 10:13 PM
  2. Connecting to remote MySQL
    By Gavisht in forum Software Development
    Replies: 4
    Last Post: 10-12-2009, 08:35 PM
  3. Replies: 3
    Last Post: 07-11-2009, 09:36 PM
  4. Problem connecting to mysql
    By Damodar in forum Software Development
    Replies: 3
    Last Post: 25-02-2009, 03:16 PM
  5. Connecting VB.net with mysql
    By Jateen in forum Software Development
    Replies: 1
    Last Post: 05-01-2009, 09:37 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,751,627,660.17311 seconds with 16 queries