Results 1 to 3 of 3

Thread: Programmatically add a database

  1. #1
    Join Date
    Apr 2009
    Posts
    87

    Programmatically add a database

    I am trying to create database with user. Which contain the information about user id, user address, user name with user age in form of table. Is there any way to programmatically create a database and setup users for MySQL.

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    Re: Programmatically add a database

    When you try to connect database programmatically you have to switch between the local computer and the server. To connect database use the following program :

    Code:
    <?php
    
    function connect_database()
    {
    $user_name ="";
    $password="";
    $database_name="local_database_name";
    $db_host="localhost";
    $db=mysql_connect($db_host, $user_name, $password);
    if (mysql_error() > "") print mysql_error() . "<br>";
    mysql_select_db($database_name, $db);
    if (mysql_error() > "") print mysql_error() . "<br>";
    }
    
    ?>

  3. #3
    Join Date
    Jan 2009
    Posts
    199

    Re: Programmatically add a database

    If you want to connect database as root or any other user with all access :
    create database mydb;
    Grant all permission on database;
    delete privileges;
    to myuser at my host identify by mypass;

Similar Threads

  1. Replies: 14
    Last Post: 24-09-2010, 06:00 AM
  2. Change FireFox proxy setting programmatically
    By Puloma in forum Software Development
    Replies: 4
    Last Post: 21-09-2010, 06:50 AM
  3. Replies: 2
    Last Post: 05-06-2009, 12:02 AM
  4. Add Columns to GridView Programmatically
    By Firon in forum Software Development
    Replies: 3
    Last Post: 19-05-2009, 06:44 PM
  5. Free SMS Server to send SMS programmatically
    By Cavan in forum Networking & Security
    Replies: 3
    Last Post: 16-05-2009, 08:23 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,714,276,286.87382 seconds with 17 queries