Website Here, Linking to Database There on other Server? - mysql

Is it possible to link to a MySql database that is on another server and hosted somewhere else entirely?

yes, just change the host configuration on your connection string
http://www.connectionstrings.com/mysql

Yes, you can connect to a remote server.
How to Enable Remote Access To MySQL Database Server

Yes - Check out connection strings http://www.connectionstrings.com/mysql

I have to recommend against it if you have a lot a data to transfer via the web, but within the network of company it works. In fact, in a common solution : you put the data on a dedicated server with performance/redundancy capabilites.
When you can connect to a local database you use a connection string such as 127.0.0.1:3306/somthing_something. With that in mind, you realise you can easily change this to another host.

Yes, as long as a path is provided to you to get "at" the MySql server. In other words, the person hosting the SQL server would have to ensure that a port is open on their firewall so that your application could talk to it.

yes, however, performance (bandwidth, latency) may be an issue depending on your specific requirements

Certainly. The most common production deployment has the database hosted on a seperate server. What might be interesting to you is the connection string that you application defines.

Yes, it is possible, but it is not wise solution, since your users will experience additional lags when your application will be connecting to some distant database.

It is possible if the hosted MySql server has a public IP you can access.

I've been trying this for days with a joomla site and can't get it to connect to a remote DB. The db is configured to be accessible from all hosts but given that joomla has a config file that specifies seperately the host, DB name, username and pass (you can't create a connection string manually) I'm not sure what other options I have to get this to work.
Did the orginal poster have success with this?

Definitely - and that is how my web host implements MySQL databases: As soon you create one it is created in a cluster of servers. Along with username&password pairs, and database name, they give you the server name.
Similarly, you can do it on your own LAN, or even over the Internet. I've done it over a LAN for testing. I would not recommend doing it over the Internet though due to very slow speed and an increase in security risk.

Related

replicate tables from mysql database to online hosting server having cpanel (5gbfree.com)

I am looking for a way to mirror or replicate a local MySQL database to an online hosting website which is 5gbfree.com. I saw the master slave replication but don't know how to use it with an online server. Can you help me please ?
I tried setting the online database as the slave but it didn't work.
problem
I don't know how to configure the online database as the slave.
Do you have access to the mysqld.ini file? If not, it is not possible to configure replication. Replication configuration relies heavily on having access to the said file and additional configuration (e.g. Firewall, Range of IP Addresses to accept connections from, creating replication user account, restarting the service)
Your best bet is to export the data from your localhost and import them in your hosting provider.
Or, check with your provider. They might be able to help you.
Additional reading here.

Connecting to a database without remote connection

Due to security considerations from my provider, I am not able to MySQL Workbench to connect to my database. The only way to access my database is to use phpmyadmin. Because I'm used to use MySQL Workbench and their tools, it is for me much easier to maintain my database. Using phpmyadmin is annoying, so I'm googeling a solution to use anyway MySQL Workbench. Is there a way to break this security consideration or to connect MySQL Workbench through phpmyadmin to gain access to the database?
If your hosting provided did it recently then I am pretty sure it is must be a response to this terrible security flaw discovered in mysql last month. The attack is as simple as running that one line shell command.
Not all OS/MySQL combinations are vulnerable. In case your hosting company was, then for a few moments - all customers
logins were at stake (including the root login).
To answer your question, unfortunately you can not do much in this case. You cannot do any port forwarding tricks even if you have shell(ssh) access because normally port forwarding isn't allowed in shared hosting environments.
In case you want to try, you can run this command on a unix box
$ ssh -L 3306:localhost:3306 username#yoursite.com
If you can login and don't see any errors related to port forwarding, perhaps your can direct your workbench to localhost on port 3306 and theoretically it should work.
If you are using windows you can use putty to do port forwarding as described here.
I think no. Only changing table Users in MySQL you can access from other IPs and hosts. And this table is not accessible by other users.

Differences between SQLite and MySQL - login and security

At first I searched in Stack Overflow about the difference between MySQL and SQLite. So there is some answers but still I want to know something. When accessing MySQL I need to give host, username, password and database parameters. But when accessing SQLite I just give database name. Can anyone explain me this why, and for security reasons also, should not be there password for SQLite database, can not be it just downloaded for example from server, so I am totally stuck. So need your help.
The difference is that MySQL is a database server, while SQLite is a database engine that works against single database files.
You are correct that the SQLite database file could just be downloaded if it's placed right in the web application where anyone can reach it.
Most server providers offer a folder where you can place files like this, so that the web application itself can reach it, but it's not directly downloadable.
You can also optionally add protection to the SQLite database file. See this question:
Password Protect a SQLite DB. Is it possible?
SQLite is mainly used for mobile and tablet apps.So they are just used for a single system.
But in MySql its a complete database and can be used from multiple system. So for increasing security ,we have to give all these. So that no one can misuse the data...
SQLite is just a file. If you have read access to the file that is the implicit security model (as well as the possibility to use database encryption).
MySQL is a network service. It can listen on an internet facing socket, meaning anyone in the world can access it if they have the right authentication credentials.
SQLite is file based, MySQL is a service which runs on the server. With SQLite you don't need to enter the database name, but actually the database file.
If you put the database file at an inaccessible location, you should be totally fine and the user will not be able to download the file.

What is a MySQL Server Instance?

I'm trying to understand what is meant by a Server Instance in MySQL. Googling for the term "MySQL Server Instance" reveals nothing, and the only reference I can find in the documentation refers to using the New Server Instance Wizard, but doesn't seem to explain why I'd ever want to use this.
Coming from a Microsoft SQL Server background, a (named) instance is a completely separate and isolated installation of the server, running in its own process and on its own port. However, in MySQL a (server) instance seems to be a different beast, as for starters it seems to use the same port as my "existing" "instance".
From the Home page of MySQL Workbench, I have the option on the right hand side to create a New Server Instance. What is a MySQL Server Instance, and why would I ever want to create a new one?
A server instance is a MySQL server running somewhere, and also how to connect to it. See the reference manual, which says:
A server instance is created to provide a way of connecting to a server to be managed.
Though it is somewhat circular, it makes sense from configuring the control manager's connection options where one can choose to connect to any number of MySQL servers, or connect to the same server in several different ways (like through a VPN or secondary network).
From this it appears each instance actually does have its own port judging from this guide to setting up an additional instance:
http://www.ducea.com/2009/01/19/running-multiple-instances-of-mysql-on-the-same-machine/
I'm not sure how this interacts in terms of named pipes on Windows though.

Connecting to MySQL Database over server

I'm quite a beginner when it comes to working with networks and the like, so apologizes up front. A while back I set up a mySQL database locally on my machine, and have built a number of simple programs that work with it. (aka root:localhost sort of thing).
This has been great, but I'm now hoping to allow other colleagues at my work to access the database from their machines, but I have no idea how.
Likely there will be some network protection issues (firewalls etc), so that may need to be taken into account... (although I have IT's help on this, neither IT or myself really know what is required to 'connect' to the database).
For example, is it just an IP I need? Do I have to change the setup of my database? I understand that localhost would not work from my colleagues computer's, for obvious reasons, I have no idea what would go in its place for others to access it.
I also do not mind having my machine run as the dedicated database machine... I would not be able to run it off a dedicated server or anything like that, beyond my machine.
Any help would be much appreciated!
Thanks.
First of all, what your colleagues need are:
The IP Address where MySQL server is
running.
User and Password to connect remotely
Have the port 3306 open on the network
A MySQL Client (mysql workbench, mysql query browser, toad, heidi or just the Command Line tool).
When you create user in MySQL the have to be something like this:
'root'#'localhost'
That means, the user will work if you connect from localhost with the user root. So you can create user allowed to connect from anywhere:
'juanperez'#'%'
And finally you have be careful about what privileges are you granting to them. Do not forget to comment a line in the options file of the MySQL that says "bind-address" (this options prevents remote connection).
For example, is it just an IP I need?
Yes. You'll be much happier if you set up proper domain names, but a domain name is just an alias for the IP address.
Do I have to change the setup of my database?
No, but... You have to add some user credentials to support remote logins. That's a change, but not a change to a schema. It's changes to the permissions.
I understand that localhost would not work from my colleagues computer's, for obvious reasons, I have no idea what would go in its place for others to access it.
What MySQL Admin tools are you using? Often there is good help there.
You must read reference manual 4.1 or 5.0
For whatever version is appropriate.
It's very clear.
A user is identified by a username#hostname. You can specify IP addresses (or even "%" for the hostname.
You will use following commandline to connect -
mysql -u<user-id> -p<password> -h<your-hostname-or-ipaddress>
For applications running on different machines trying to connect to your database, you only need to replace 'localhost' with your machine's hostname or ipaddress.
In, general if you are able to ping your machine from a different system, your database can be connected to from that machine, just use whatever name you used for 'pinging' in place of localhost.
Use your workstation IP address or workstation name. You will need to enable remote access. Go to this link for how:
http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html