Re: Databases in other directories
Posted by:
RiggsFolly
(---.as13285.net)
Date: April 13, 2013 04:36PM
Dont think you quite understand the concepts here.
phpMyAdmin connects to a MySQL instance. It can access any/multiple database(s) running in that MySQL instance provided the userid you connect with has access to that/those databases. (security).
Now phpMyAdmin is capable of connecting to any instance of MySQL in the world provided you know its ip address and a valid userid/password configured on that mysql instance that allows access from an external ip address and more specifically, your ipaddress.
There is your problem !!! For security reasons mysql is normally setup to only allow access from the machine it is running on ( localhost ) or specific ip's in the hosting companies network ( for situations where one mysql server instance is used for multiple hosting accounts and run on a seperate machine). After all its only the code that runs on the server that ever need to access the database, again security.
This stops me connecting to your databae on your hosting accounts and messing with the database.
Now I know it is possible on some hosting packages to create users that can connect from remote ips but it is not normal and also not widely publicised, again for security reasons.
So basically its normal to create and design databases locally, then back that db up locally and then copy the backup to the hosting account server and to a restore of that database using that backup.
Now if you find yourself using a hosting package or just wanting to connect to a friends wamp instance this is what you would change
edit
c:\wamp\apps\phpmyadminx.y.z\config.inc.php
which by default looks like this:
/* Server: localhost [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
Change it to look like this:
$i++;
$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'http';
$cfg['Servers'][$i]['user'] = '';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
$i++;
$cfg['Servers'][$i]['verbose'] = 'LAPTOP';
$cfg['Servers'][$i]['host'] = '192.168.2.10';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'http';
$cfg['Servers'][$i]['user'] = '';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
Also change this param
$cfg['ServerDefault'] = 1;
to
$cfg['ServerDefault'] = 0;
NOTE you now have
Servers[1]....
and
Servers[2] ......
configured and can have as many as you like.
This will make your phpMyAdmin start on a new screen where you can select the server you want to access. It will then throw a login dialof for you to enter the Userid/password for that specific mysql instance.
In this example the Server[1] is accessing the mysql instance on my locahost on the pc I an on, and Server[2] is accessing my laptop which lives on 192.168.2.10. This ip address could be any ip address, not just one local to my network.