Moving a Local mySQL database from Laravel/Homestead to live site database - php

I'm new here so sorry if this is posted in the wrong place >.<
I recently started using CraftCMS and decided to make a site with it. After looking at multiple forums about development I decided to use Laravel/Homestead to develop the site locally. It's working great! Everything is working fine, all the data is being saved and it works every time I boot up homestead.
The one question I have is how to move all this data from my local database to a live site. I have Bluehost and I know it's capable of mySQL and hosting a CraftCMS site. I just need to know how to transfer all the data.
I've been using Sequel Pro to monitor everything locally. So I feel like it's possible. Not really experienced with databases in this way. Just need a nudge in the right direction. Thanks!

Can you access to your Bluehost DB in Sequel Pro? If you can, I think you should first go to your local homestead DB and click [File]->[Export]. And go to Bluehost DB and click [File]->[Import]. Remember to choose the same format as you exported.

It's definitely possible.
If you can export your craft db with sequel pro (or the command line)
Assuming your local database env is root with
mysqldump -u root -p password mycraftdb > dump.sql
You'll need to import this sql file in phpmyadmin on bluehost
Here's a help doc. https://my.bluehost.com/hosting/help/256
Start a new database unless you're using the old tables in your new local craft site. Definitely back up your old one.
Whenever you work with a host like Bluehost, godaddy, etc. You're going to have an obnoxious time trying to get everything configured to pass the system report for craftcms. Sometimes you'll even have to reach out to the host to do something simple like upping a memory_limit.
Here's an article my friend wrote about his experiences using craftcms with these hosting environments. It could be helpful.
https://medium.com/#importantcoding/craftcms-how-i-hate-to-love-you-e0d26722a1d2

Related

Can't create new entries in DB

I am currently running 2 websites that share the same source code, changing only the DB and some minor aspects.
I recently launched my 2nd website and although everything appears to be running just fine I realized that I can't add new entries in the DB. It just gives me the message that the entry already exists, which is not true since there is only a few entries and I am obviously testing using unique entries. Another thing that I noticed is that the data that exists in the DB (I used an internal server to test things out) can be edited, which I assume that UPDATE statement is working but not INSERT INTO and DELETE. It appears that there is some problem with the connection/permission to add/delete new entries, while updating is fine.
All this is very strange as the code (PHP and JS) is exactly the same between websites and the only thing that changes is the VM I used for each of them, which makes me believe that the issue is somehow in the configuration of the webserver. I have replicated all the configurations from the other website, so I am not sure if I am missing something. Here's a list of all the configuration I have implemented:
edited 000-default.conf (of Apache to set the new document root)
changed the ownership of my app to www-data
created a user group with myself in it and changed the group of all subdirectories/files to this group
opened up the port 3306 for mysql
I honestly can't understand what is wrong, I am clearly missing some configuration setting but I have no clue what it might be. One thing that is different is the MySQL version between websites. The website that works is running this version:
5.7.26 MySQL Community Server (GPL)
While my new website is running this:
5.7.19-0ubuntu0.16.04.1 (Ubuntu)
Could this be an issue?
Any help would be appreciated.
Thank you.

How to easy configure Hadoop for big MySQL table

I'm doing my student work. Please help me understand in what direction should I move.
So, I have a big MySQL database (31.3Gb, 130 millions rows) on my PC. I have written a simple html page (interface for my program). I'm using PHP for connecting to my database, AJAX for retrieve data from a server asynchronously and OpenServer (local server for testing).
How it works: the user selects some filters on my html page, clicks the search button, and it displays the main table.
Everything works well, but what should I use to connect my project to Hadoop? It is a mandatory requirement.
Maybe HortonWorks/Cloudera/Docker?
It will be very useful if you send links on some useful guides.
The main criterion is simple to configure and install. Also, I have only 4Gb of RAM on my laptop, so most likely I have to use old versions of tools. HortonWorks 2.1 was successfully installed even on my virtual machine (Ubuntu 14.04)
In advance thank you everyone for your help!
You can use Sqoop import to push data from MySQL to Hive.
Then, you can query via HiveServer2.
For getting Hadoop and other components, it is best to use HDP or CDH sandbox. If your machine resources do not permit using the sandbox, consider using AWS.
Once you have data in Hive, you can point your application to query Hive and serve results, instead of going to MySQL.

Accidentally uninstalled mysql on AWS EC2 with wordpress multisite. Need a little guidance

I have a wordpress multisite installation running on an AWS EC2 (t2.medium).
After messing around trying to get phpmyadmin installed on the server I accidentally deleted httpd,mysql-server etc. It broke everything.
Thankfully, I used a plugin called Snapshot from wpmu-dev and had everything backed up but now I'm running into some trouble and not entirely sure how to do this.
Current situation:
1. Created an instance snapshot through my aws dashboard.
2. Backed up everything from /var/www/html/ to my local drive.
3. Reinstalled mysql and httpd, started it, went through the steps provided here - https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html - however, when setting up the database it states that wordpress-db and the user are already there and my old password still works yet wordpress isn't working?
So I'm not sure where to go from here, shall I just delete my instance and start again from scratch? Loading what I need back into the /var/www/html folder? Or is there a way that I can completely delete my database and then rebuild the tables with the snapshot and get back to where I started?
Thanks in advance for your help folks, really stuck here, have a website that's down!
If you are not sure what happened I would recommend you start from scratch.
Launch an EC2 instance and follow the steps on the guide you provided:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html
Download MySQL workbench and connect to the database (remember
modifying the security permissions temporarily
to be able to connect to the database from your computer) (https://dev.mysql.com/downloads/workbench/)
Restore the sql backup (if you have one, or create one if you don't) to restore the database to your new ec2 instance MySQL. You can do this following the Data import section: https://dev.mysql.com/doc/workbench/en/wb-admin-export-import-management.html
Make sure the configuration file is correct (url, database path, name, etc) (https://codex.wordpress.org/Editing_wp-config.php)
I would recommend to point your domain to your new ec2 instance only after it has been properly configured and tested.

Have a local codebase but remote database in WordPress

In our team, I used to be the only developer, coding directly on our remote dev server but we're hiring more developers so we have a need to move the codebase to our local machines so we don't encounter any file collisions.
However, even though I want to use a local codebase, I don't want to use a local database. Syncing the database seems like a hassle and is to be honest not really needed. So we're sticking to multiple codebases, but one database.
How can I run Wordpress on my local machine, while still using our remote server database? How do I set this up in MAMP?
I'm kind of new in setting up servers/ports/databases etc so it's not my strong suite. The problem which I don't know how to get around is the urls.
For instance, our WP sites have the url format:
site1.portal.dev
site2.portal.dev
When I type these URLs I want the codebase to be local but the database to be our remote dev server.
Update the config to point to the remote database. Job done.
As long as the configuration of that database allows you to connect to it, it's very simple.
An example of updating the wordpress config
I work in a multi-developer team. I've found that the best option is to have a full local environment.
We use wp-migrate-db pro for copying the dev database down locally. Once configured (per site) it takes a minute to grab the latest copy from dev.
Having this separation allows your team to make changes for their local development efforts (such as entering bad data, test pages, posts etc) without affecting other developer efforts.
This approach also works well for working with developers of various skill levels...and helps to reduce bigger issues that you may come across later on.
Using your site1.portal.dev should work, as the site_url and home_url. When you click on a link in your dev portal, it will continue to use site1.portal.dev, as WordPress thinks your site resides there. The database just holds the information, it doesn't matter where it resides.
You can connect to your remote mysql instance by providing the correct host, username, password. Usually it would be localhost, but in your case, you will want whatever the IP/DNS address for the machine that is hosting your mysql server is.
You can test the mysql connection with
mysql <database> -h <host> -u <username> -p
add -P <port> if your mysql server is listening on a different port.
I know this is an old question, I just post the answer I found that works for me in case anyone is looking for the solution of "How can I run Wordpress on my local machine, while still using our remote server database"
Install WordPress on your server (http://yourdomain.com)
Configure it with your database
Make sure whitelisting your local machine IP in "Remote MySQL" within your server's hosting panel
Pull down the entire WordPress directory onto your local machine
into a project folder
Add project folder to MAMP or your local web server app of choice
(make a note of your Server Name)
Open your LOCAL copy of wp-config.php Change 'DB_HOST' to
'yourdomain.com'
And add the following just above 'require_once(ABSPATH .
'wp-settings.php'); in wp-config.php file
define('WP_CACHE', true); $currenthost = $_SERVER['HTTP_HOST']; $mypos = strpos($currenthost, 'localhost'); if ($mypos === false) { define('WP_HOME','http://yourdomain.com'); define('WP_SITEURL','http://yourdomain.com'); } else { define('WP_HOME','http://localhost'); define('WP_SITEURL','http://localhost'); }
Replace each instance of 'localhost' with your 'Server Name' in MAMP. (localhost is default)
Source URL: https://coderwall.com/p/ck8v4a/remote-database-with-local-wordpress-instance

'Mirror' database connection using PHP

Now before I start I just want to say that I have absolutely no idea if this is possible.
The Question
I am used to managing databases on my computer using Sequel Pro, and that is what I have done for the past few years with my Linode VPS. I recently purchased iPage hosting to store some static content and I wanted to set up a database to keep an easy archive of it. Having created the database and set up the access details I wrote a basic PHP script for it.
I wanted to connect via Sequel Pro, but with a lot of shared hosting they don't seem to let you do this for security reasons. My question is, would it be possible to write a script that you connected to the same way as a database, but which processed all your requests to the database before returning it? If it is possible, how would you go about it, and if it's not, why?
SQLyog has php proxy, and it is generally one of the methods for connecting to mysql databases which are bound to localhost. Also, some cPanel hostings have an option where you can specify external IP which can connect to the database, have you asked the support if there is such an options?
In SQLyog, feature where they use php proxy is called HTTP Tunnel. Maybe there exists something like that for Sequel ?
https://static.webyog.com/docs/SQLyog/HTTP_Tunneling_SQLyog_MySQL_Client.html

Categories