Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

MySQL connection string help

  • 31-08-2004 09:18PM
    #1
    Registered Users, Registered Users 2 Posts: 577 ✭✭✭


    Hi am new to Mysql and am looking for the correct connection string format

    eg..

    "Provider=MYSQL??;Password=blah;User ID=blah;Data Source=mysql.hosting365.ie"

    The Mysql is running on hosting365 on a windows2003 machine

    Thanks in advance for any help on this


Comments

  • Registered Users, Registered Users 2 Posts: 1,967 ✭✭✭Dun


    Are you looking for a php connection string? Or are you looking to connect over a command line?
    Command line:
    c:\mysql\bin\:> mysql -h server -u user -p
    (then it prompts for your password). type connect databasename to connect to a database.

    If it's the php code you're looking for, it's:

    [php]
    /* These are the variables to connect to the database */
    $hostname = "databaseserver.com";
    $username = "username";
    $password = "password";
    $database = "databasename";
    // This is to create the connection:
    $connection = mysql_connect($hostname,$username,$password);
    // And this is to choose the database:
    $db = mysql_select_db($database,$connection);
    [/php]


  • Registered Users, Registered Users 2 Posts: 577 ✭✭✭Velcrow


    Thanks for that!!

    I am using ASP - but I think I can convert what you have and make another effort.


  • Registered Users, Registered Users 2 Posts: 1,967 ✭✭✭Dun


    Ah right. Have a look at this.


  • Registered Users, Registered Users 2 Posts: 577 ✭✭✭Velcrow


    Once again - Thanks, Up and working!


Advertisement