1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Trying to connect to MySQL from local program

Discussion in 'Plesk for Linux - 8.x and Older' started by screech8780, Mar 7, 2005.

  1. screech8780

    screech8780 Guest

    0
     
    I am using DreamweaverMX2004, and am trying to set up a user registration for my site. I have been able to create it successfully on my local server, but when I attempt to make the connection to the database on the remote server, I get an error saying that I cannot connect... urrghhh! I have tried connecting the way I connect to plesk and still nothing....

    Thanks...
     
  2. justyxxxx

    justyxxxx Guest

    0
     
    If it's a Plesk server running MYSQL, then you need to tell SQL to allow remote access to MYSQL from another server. Run the following on the Plesk MYSQL database server that you're trying to access remotely, changing the password, ip address, and username:

    To allow certain ips access to MYSQL:

    mysql -uadmin -p`cat /etc/psa/.psa.shadow` -Dmysql -e "insert into user values ('111.111.111.111', 'databaseusernamehere', password('databasepasswordhere'), 'Y', 'Y', 'Y', 'Y', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N', 'N')"

    and then run:

    mysql -uadmin -p`cat /etc/psa/.psa.shadow` -e "flush privileges;"
    (Note:_ The Y's and N's above indicate permissions)
     
  3. screech8780

    screech8780 Guest

    0
     
    That is a bit confusing for me. I don't like attempting something that I am not familiar with... This is what I have going on... I am running Plesk Reloaded 7.5.1, it has ASP, PHP, MySQL, and I think there may be some other stuff too. I have access to the MySQL through phpadmin 2.6.0-pl3 and MySQL 3.23.58. Phpmyadmin is not giving me an option to set privledges, and when I try to connect remotely using port :8443, with my admin credentials, I get the following error:

    A server timeout error has occured. Here are the possible reasons.
    1.Please make sure the server is up and running.
    2.Please verify that the ODBC DSN exists on the testing server.

    It is probably something simple, but it has managed to elude me.
     
  4. justyxxxx

    justyxxxx Guest

    0
     
    I guess perhaps I don't understand your question. Basically, if you're trying to access MySQL on Plesk Server A from another computer, let's say Server B, you have to tell MYSQL on Plesk A to allow Server B's ip address access to MYSQL. That is what the command that I gave you does. If you're trying to access it locally, then you don't have to do this. Generally only local is allowed access to MYSQL unless you tell it otherwise. You cannot allow certain computers access to MYSQL via the Control Panel - not yet anyway. But, you can allow them access via command line, which is what the above command that I previously gave you does. Replace 111.111.111.111 with the address of Server B.

    To see what ip addresses are allowed access to MYSQL, the following will give you all external IPs to which you gave MySQL access:
    # mysql -uadmin -p`cat /etc/psa/.psa.shadow` -Dmysql -e"select Host from user where Host!='localhost';"
     
  5. Jllynch

    Jllynch Regular Pleskian

    28
     
    Joined:
    Nov 11, 2003
    Messages:
    242
    Likes Received:
    0
    A program like webmin makes it easy to make these changes through its GUI so you don't have to issue that scary looking MySQL command above.

    You can get it here;

    www.webmin.com
     
  6. tobtob

    tobtob Guest

    0
     
    Thanks for posting the info on how to access mysql remotely.

    In my case I need to grant access from "ANY" ip address but limited to a unique USERNAME and PASSWORD.

    Can I simply replace the IP in your example with a % sign ?

    Thanks,
     
  7. tobtob

    tobtob Guest

    0
     
    Ok....... I answered my own question. replacing the IP with a % sign does what I want.
     
  8. manarak

    manarak Guest

    0
     
    the mySQL port is 3306
     
  9. Coldcutt

    Coldcutt Guest

    0
     
    Hi, sorry I am very new to all the command line stuff.
    But where do I run the mysql command you mention from?

    I have tried running it from the standard login location, and I am guessing it must be run from within a specific directory, is that right?

    If so could anyone tell me the exact location?

    Thank you kindly.
     
  10. justyxxxx

    justyxxxx Guest

    0
     
    I use Redhat Enterprise 3 and all I have to do is enter the command lines via a telnet, SSH or via the terminal after logging in as a user with the appropriate permissions (such as root, for example). I don't have to go to any specific directories to run them.

    I accidentally included a # sign in the beginning of one of the command lines. You can delete the # sign at the beginning and proceed with entering mysql . . . . etc
     
  11. EvolutionCrazy

    EvolutionCrazy Basic Pleskian

    23
    90%
    Joined:
    Jun 4, 2005
    Messages:
    65
    Likes Received:
    0
    or just install phpmyadmin and create users with access from % (instead of localhost) as you want :)

    Code:
    cd /home/httpd/vhosts/default/htdocs/
    mkdir private
    cd private
    wget [url]http://heanet.dl.sourceforge.net/sourceforge/phpmyadmin/phpMyAdmin-2.6.2-pl1.tar.gz[/url]
    gzip -d phpMyAdmin-2.6.2-pl1.tar.gz
    tar -x --file=phpMyAdmin-2.6.2-pl1.tar
    cd phpMyAdmin-2.6.2-pl1
    then (change nano with vi or any other editor)
    Code:
    nano config.inc.php
    and place there user e password that you are using to access plesk
    (admin e password)

    select also to protect it with auth or cookie method of course :) otherwise everybody can access to it and hack everything :D

    then you are ready to administer your users/database from

    http://yourip/private/phpMyAdmin-2.6.2-pl1/

    :)
     
  12. cancer10

    cancer10 Guest

    0
     
    Make sure the server firewall is not blocking the mysql port.
     
  13. inc595

    inc595 Guest

    0
     
    The problem with creating users outside of Plesk is if you use psadump you will only backup those DBs made with Plesk. The command line is not scary once you make sense of what the command is trying to do. You can install your own phpMyAdmin on your site and login as your Plesk admin user. This will allow you to access all the databases and priviledges on the MySQL server. Rather then creating new users you can modify their privileges. Allowing only certain users access from outside helps in security. I use this for my config.inc.php for my phpMyAdmin to gain administrator level access to MySQL.

    Code:
    <?php
    /* Servers configuration */
    $i = 0;
    /* Server localhost (http) [1] */
    $i++;
    $cfg['Servers'][$i]['host'] = 'localhost';
    $cfg['Servers'][$i]['extension'] = 'mysql';
    $cfg['Servers'][$i]['connect_type'] = 'socket';
    $cfg['Servers'][$i]['compress'] = false;
    $cfg['Servers'][$i]['auth_type'] = 'http';
    /* End of servers configuration */
    ?>
    
     
Loading...