Reputation: 2134
Is it possible in wamp to move a single database to another location but not the whole mysql-data directory?
All I can find is that in my.ini you can change "datadir" to another path but as I understand it you have to move all databases to the new location. I have several different databases on my computer using wamp, and most of them I want to have in the original location, but one of them I want to have in another directory (for cloud sharing reasons). Is this possible?
Upvotes: 0
Views: 568
Reputation: 94662
Well it is possible to use SYMLINKs or rather JUNCTIONS as they are called in Windows.
If you are using WAMPServer 2.5 and you want to see a JUNCTION in action look in the \wamp\bin\apache\apachex.y.z\bin folder, there are a number in there linking to the php folder. If not then just do this to create them
wampmanager -> Apache -> Version -> click on the version number
This will create the links.
So you would move the actual data files out of \wamp\bin\mysql\mysqlx.y.z\data\xxx to a shared locations.
You then create a junction in the \wamp\bin\mysql\mysqlx.y.z\data\xxx folder for each file. MySQl will work having done this. Not sure if these junctions will work if you try to link to a cloud.
HOWEVER Here be dragons
The problem with this approach when used with MySQL data files is that you have 2 seperate MYSQL instances, that do not know about each other, both thinking they are in complete control of this database and its tables.
So if a user on MYSQL1 and on MYSQL2 both attempt some process that requires a lock or something like that, they dont know that the other thinks its got a lock, but of course MYSQL1 is only locking other processes going through MYSQL1 so MYSQL2 could be doing exactly the same thing thinking it has locks, but its only locking processes on MYSQL2.
Data corruption is only a hop-skip-and-a-jump away using this approach.
As MYSQL is a database SERVER, you should consider installing a MYSQL on your cloud and then any number of people can connect to it and all the functions of a Database Manager will work correctly.
Your web site/Application then connects to this MYSQL Server in the cloud and does not use the MYSQL running on your PC.
On the cloud MYSQL, you just need to setup a userid that your site/app uses and that userid is allowed to connect from 2 remove hosts, i.e. you and you buddies ip addresses, and has the correct privilages just on the database you are both working on.
Of course make sure the root user has a VERY GOOD password on it, and can only be used from you and your buddies ip address.
I hope this gets you moving in the right direction.
Upvotes: 1