Set up mysql separately from servers - mysql

I have a direct admin server that hosts 8 sites
These sites have high traffic and a lot of connection with the database, and when add-ons are implemented for optimization, etc., our database resources reach 12 GB and cause disruption and slowness.
I plan to install a mysql local server and separate the database from the direct admin server.
Does this make sense? If yes, is there a training link for this?

Related

Where are databases stored?

Where are databases actually stored? Do we store the database in the web server itself (like NGINX or Apache), or do we have any other kind of server dedicated to only the database, if this is the case, how would we connect to the database from another machine?
For example, I've tinkered with MySQL databases stored in my local machine, which i used to create web applications: how could i store (host) those databases somewhere else in another machine and still use them in the same web application running on a completely different machine?
Where is the database stored?
The database -- the relational database management system -- is a network-accessible hunk of server code. MySQL, for example, is a server software package.
That server software runs on a computer -- in internet parlance a server machine -- somewhere. Maybe it's on your laptop. Maybe it's on a server machine in the next room. Maybe it's on a virtual machine you rent from AWS,Azure, Digital Ocean, or some other cloud vendor.
The machine hosting the database for a web site can be the same machine that hosts the web site's web server, or a different machine. Modestly sized web sites often run the database and the web server on the same machine. Bigger sites often have multiple web server machines all using just one database machine.
As long as the web server code can reach the database server via a TCP/IP connection, you have a working configuration.
Where is the database stored?
The database server software uses the file system (disk, SSD drives, or network-attached storage) of its host machine to store the data in its tables. The structure of the file-system files used by the database server software is a huge topic far beyond the scope of a StackOverflow answer. Suffice it to say that those files are useless without the database server software to read, write, and back them up ( with a few special exceptions).

is there possibility to connect asp.net website hosted on a different server to a database on another server?

I know quite ok that is is not a good idea except for inevitable reasons. it is ideal to host database on the same server with the web applications. However my server couldn't log phpmyadmin using MySQL 5 despite all credentials correctly provided with no error except for the note that "Cookies must be enabled past this point." and i have set cookies to allow, add the website and others configuration and still not working. i have tried several browsers both on PC and mobile phones and its not working either. i tried to create database from several online remote source as FreeSQl, FreeDB, Somee etc, it works fine while tesing through visual studio locally on pc remotely but as soon as i host, it will not work as a result of connection issue which am aware of. i hope someone will help me out, possible provide me with link of where i can create and setup MySql database and the connection will work live on another server where i host my website or How to solve the Phpmyadmin issue. I will fine with it. I am available to answer questions so as to help me achieve my aim. Thanks
Not only is this possible, but is a common setup. You will often have some database server system - and it certainly not going to host the web site. The web site is VERY often hosted and placed on a different server.
In fact, some companies will adopt a hosting company for their web site, but it hits and connects to their database server that is on premises (or so called "on-prem"). In fact this approach is often used to allow say Android phones, and other services to consume data from the company database, but that company would NEVER think of opening up ports to outside connections. (they setup a secure connection between the web hosting system and their local network - often VPN, but it really don't matter. As such the company database server ONLY allows connections from the local network and then say a pre-defined IP address incoming from the web hosting.
So, you can adopt cloud hosted say SQL running on the Azure OS. (SQL Azure). And just like all instances of Azure? Well security can be several approaches. I mean a database hosted on Azure is RARE simply opened up to the wild internet to allow ANY one to connect. Heck, 16 years ago I tested opening up my home router to outside SQL connections. In less then 20 minutes, I began to see attempted logons to that SQl server.
There are bots that scan IP numbers + ports on the internet. So I began to see this:
Logon fail: sa, password="password"
Logon fail: sa, passowrd="123456"
etc. etc. etc.
So there is quote a few companies offering hosted database systems Azure, and AWS come to mind. However, they don't allow just any old one with a IP address to connect. In a lot of cases, security will be some fixed IP address (like for example the companies network or external fixed IP that their ISP provider gives them. While most consumer internet systems are not fixed IP addresses? Today even relative smaller business need and want workers to work remote. So they pay a few extra dollars per month (often only about $10, maybe $20) and now they have a fixed IP address. And from that they tend to setup and adopt a VPN based on that now fixed IP address.
The hosted SQL server? Well, it also will be setup to ONLY accept external incoming request from a known IP address - and thus those bots and IP scanners can't connect.
Now MOST low cost web hosting plans include SQL server or MySQL as part of the low cost hosting package. In that case, the connection from the web site to the database server is INTERNAL and such database systems do NOT allow or permit outside connections to the database server. So, when buying a book on Amazon.com, their web hosting system can easy connect to the database - but that is NOT a outside connection.
However, can you use that VERY low cost budget web hosting, and connect OUT to a outside database? yes, a lot of them allow this, and as noted, it not going to be a surprise that some database is being hosted say on Azure. And as noted, in this case, your web hosting software will thus connect to Azure in much the same way any other outside system connects. So while few web hosting systems allow OUTSIDE connections to the database included with such packages? Well, a lot of them certainly allow you to reach out - and hit other web sites, other web services (maybe a weather and temp display on your site????). So reaching out as a general rule is possible - reaching in? not so much!! about 10 years ago, quite a few web hosting providers - even low cost ones DID allow external ODBC connections to the database system. However, due to security issues - most providers don't allow this. I think even GoDaddy still allows this, but if you do ask for this ability, then the database server(s) you get are different then their regular ones - again they don't want to open up security issues and that can often open up holes to other customers databases hosted on that system. But, as noted, with the rise of SQL Azure and others? We are seeing a real comeback in hosting providers now offering external connections to database systems that are seutp to allow the hosted web sites to hit those databases.
So you have to check with who ever going to provide you with the web hosting, and find out if that web hosting allows "reaching out" to other web services, or reaching out to other database servers - as I noted - this is quite common now. it just a question then does the web hosting say support a VPN to reach out, or say reaching out on a particular port + fixed IP to some database server is the nitry grity details that will vary based on your needs, or what that ISP in fact allows.
So what and who and what ports are allowed to reach out? Well, that's going to be based on what your ISP and hosting plan for the web site allows - you have to check if they allow hosted web sites to "reach out" of their web hosting plans.

Can I host my own Mysql Database?

Our teacher ask us if we can make our database online
so we buy a hosting plan but it's to slow.
I don't want to buy or upgrade my hosting plan.
So I'm thinking if I can host my own Mysql Server.
My Current PC Specs is i7 and 16GB RAM with 50MBPS internet connection.
Yes you technically could.
You could easily set up WAMP
The more complicated part would be accessing that from an external network.
You would have to set up your router with a static IP or with a dynamic dns and then forward ports.
Short answer - Yes.
You will have to though take care of below things when you go about managing your own database.
Have a static ip
Database backup strategy
Backup restoration strategy
Horizontal scaling / vertical scaling strategy
Sharding and replication (if needed)
Managing security
In this case your computer configuration is ok. But Dear if don't buy or upgrade your hosting plan you have to purchase a real ip address which is more costly for you. But you can talk with your ISP for providing a real ip against your current connection. because your current internet connection is good enough for you.

Data transfer between local server and AWS server

We have an ASP.NET MVC 5 web application that reads data locally from within the same server. This server is in Europe. However when trying to read the same data from an AWS server based in Sidney the lag is many times greater. A ping from our local server to the AWS server in Australia takes 5 seconds. The data needs to be located in Australia because of data protection laws issued by the Australian Government. The database is MySQL. We have created a VPN between both servers and made no difference.
What are our options in order to improve the speed between these two servers?
If it is a web application serving content to users over internet you can use CloudFront distribution to reduce your latency issues.
https://aws.amazon.com/cloudfront/
If you are trying to connect your servers from your data center to AWS
Use AWS Direct Connect, this will provide a dedicated link between your on-premise datacenter and to the AWS Servers; Decreasing your latency by a lot.
https://aws.amazon.com/directconnect/
AWS runs your application regardless of which platform(ASP.NET, JAVA, C...) it is, AWS only provisions infrastructure. You don't need to worry about the platform on which your application is running and what database it connects to. You just need to ensure that all the network connections are properly open so that your servers can communicate with AWS servers.

Database Choice for WebSite

I have developed several websites on my local host for school. I can program database driven aspects of a webisite such as a blog on my own no problem. At school I used a MySQL DB which was hosted on a dedicated server, so when the server went down I could not have access to my data. I also have a mysql DB on my localhost but...my question is this: If i use the MySQL DB on my localhost, won't I only have access to the data when my computer is running so that my site can make server requests?
How can I set up any kind of DB for my site that is reliable and doesn't depend on my localhost to act as a DB Server?
I am now developing in .NET
Thanks. PS I don't have access to schools' server any more.
PPS I still don't have a site set up through a hosting provider...probalby going to go with godaddy
You'll need a server for that. A server will cost you on a monthly basis, I haven't heard of any free mysql servers, someone else may be able to help you with that.
Regular hosting providers supply PHP and MySQL server. I run my sites on Dreamhost (www.dreamhost.com)
It might also be worthwhile to look into Amazon EC2 : http://aws.amazon.com/ec2/
Also Amazon RDS for pure database only usage : http://aws.amazon.com/rds/
They provide a pay as you use service and the tier 1 service is free for the first year as I understand
There's no magic, you have to host your DB on a server that will run 24/7. Could be on the internet, it depends on the firewalls surrounding you.
The website will always depend on some sort of database server, why so worried that your database will be unreachable? Your webserver can go down also and will have the same consequences as the db.
Why don't you get some paid hosting? It is fairly cheap these days, for around 30dollar/year you will have some reliable hosting. When the DB will break down, it is not your responsibility.
If you don't want te be dependent of MySQL, you will need to use plain-text database that will be maintained by PHP or something.
You might consider running the MYSQL in i.e. a cloud provider, like Amazon EC2. It will certainly cost some money.