Urgent : can't log to sql database with db_user created remotely

Discussion in 'Installation/Configuration' started by bmi64, Oct 22, 2016.

  1. bmi64

    bmi64 New Member HowtoForge Supporter

    Hi,
    I'm trying to solve a problem for next monday but I don't find any solution :
    I created my database remotely :
    [​IMG]
    and then I use this script to create database user :
    PHP:
    $username 'XX';
    $password 'XX';
    $soap_location 'https://X.X.X.X:8080/remote/index.php';
    $soap_uri 'https://X.X.X.X:8080/remote/';

    $client = new SoapClient(null, array('location' => $soap_location,
        
    'uri'      => $soap_uri,
        
    'trace' => 1,
        
    'exceptions' => 1));
    try {
      if(
    $session_id $client->login($username$password)) {
        echo 
    'Logged successfull. Session ID:'.$session_id.'<br />';
      }
      
    //* Set the function parameters.
      
    $client_id 3;
      
    $params = array(
        
    'server_id' => 1,
        
    'database_user' => 'C3_61021162801',
        
    'database_password' => 'BBPvwVae21'
      
    );
      
    $database_user_id $client->sites_database_user_add($session_id$client_id$params);
      echo 
    "Database ID: ".$database_user_id."<br>";
      if(
    $client->logout($session_id)) {
        echo 
    'Logged out.<br />';
      }
    } catch (
    SoapFault $e) {
      echo 
    $client->__getLastResponse();
      die(
    'SOAP Error: '.$e->getMessage());
    }
    I've checked :
    $client_id = 3; is the same I used to create the database

    When I click on database connect (red arrow in the image above), I get this :
    [​IMG]
    Where is my mistake ?

    Thanks for help, I'm going crazy with it :/^^
     
  2. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    A db-user is not added to mysql until you add a database for this user.
     
  3. bmi64

    bmi64 New Member HowtoForge Supporter

    Thanks for your prompt answer.

    I forgot to explain this in my first post :
    In mu previous post, I used a simple script to try and test creating a database user, but in the complete job, I use a script to create everything in one shot :
    1-sessionid
    2-create domain
    3-add a database user
    4-add a database
    5-FTP user

    Finally I get a database associated to a database user :
    [​IMG]
    You can see that in my complete script, the database user is associated to the database.
    And the final return of my script gives me those informations :
    [​IMG]

    But I can't log in my database with the button indicated by red arrow :/
    What is the problem ?
    Is my user login too long ? (14 caracters)
    Is my database user password using wrong caracters ?
    Is my database name too long ? (19 characters)
    Or where is the problem ?
    I really don't understand.

    I hope I can solve this before tomorrow :/
    Thanks a lot for help !!
     
  4. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    Can you see the db-user in the mysql user database?
     
  5. bmi64

    bmi64 New Member HowtoForge Supporter

    Yes.
    I launch a new complete website creation + users and get :
    [​IMG]
    and in my database :
    [​IMG]
    but I still can't connect with the button and database user id's
     
    Last edited: Oct 24, 2016
  6. bmi64

    bmi64 New Member HowtoForge Supporter

    Something that is strange is :
    my script uses the remote account to create everything.
    in my ISP config I use :
    'ISPusername' => 'user', // → client of websites created
    'ISPsoap_id' => 'dev', // → remote user

    The SQL database user can't log in when created with my script.

    If I log in ISPConfig interface
    and then log as 'user' client,
    and create a new database user,
    And finally assign this database user to the database,
    I can log in !

    That's why I don't understand.
    Thanks for help !
     
    Last edited: Oct 24, 2016
  7. bmi64

    bmi64 New Member HowtoForge Supporter

    Up ?
    Thanks for any help !
     
  8. bmi64

    bmi64 New Member HowtoForge Supporter

    I found the solution :

    My script use all $params in the same array, so an error was to use :
    • for domain creation :
    PHP:
    $params['type'] = 'vhost'
    • but for database creation I needed to add
    PHP:
    $params['type'] = 'mysql'
    so I overwrote $params['type'] withg this second one after domain creation and before database creation.
     
    Jesse Norell likes this.

Share This Page