How do I move a DB from localhost to a live server - php

I built a database and website using Xampp which allows me to use and test php and a database which is hosted on localhost. I now want to move this to a live server. I have moved the website to a live server using 123-reg. How do I move the database?
I have tried exporting the phpmyadmin db and placing the sql file in my live directory, not sure of the next steps. Unlike other hosting websites, 123-reg does not seemingly have a phpmyadmin option as a web tool. It does however have something called "MariaDBDatabases". Can I use this somehow?

Yes that is the correct way. You just have to export your database on localhost. Then import in your live database given in link
Go to export option. click on GO.
Make a new database.
And Import in that

Yes off course.
Generally, hosting providers don't provide insecure links like http://anything.com/phpmyadmin as DB access location.
Instead of that, they provide UI in control panel ( dashboard ) to access all the features.
It ensures the added security to avoid your custom database from unauthorised exploitations.
I don't know the UI features of your host provider exactly, but as you said, click over MariaDBDatabases, create a new DB (Copy that), create a new User (Copy that along with the password).
Now click over DB just created, I hope it will redirect you to phpMyAdmin.
There you can import your SQL.
Now all you have to do is, change the DB Credentials in your project.

Related

Trying to work on a client's Drupal site from my local machine

I have a client who wants me to update their Drupal site. I've never done this before, and I want to work on it from my local machine just in case something goes wrong. I have no idea where to even start!
First off, how do I access my client's site files so I can get them onto my computer? I've tried entering the information the client gave me into Cyberduck, but it won't give me access. Is there another way to get access?
Also, how do I host it locally? I have XAMPP, but I'm not sure how to use it.
That being said, I have found a few forums that should help me set up the local server. I just don't know how to get the files from the live server to my computer.
I know this is a super noob problem, but I could use the help. Thank you!
Well, for the basic question, you have to get the correct credentials from your client. There's no alternative, really :D
While you're at it, you'll want a copy of the site's database too.
For the question "how do I host it locally?" Here's how I would go about it.
Get the site into version control.
Given that you were given (S)FTP credentials, I'm guessing the site is not version-controlled. If that's correct, then that is probably the very first thing you want to do. This will allow you to keep track of the changes you've made on your local site that are different to the production version.
Create an empty directory on your computer.
Navigate to the directory in a terminal and run git init.
Add a .gitignore file to that folder (you can create your own, or use one customized for Drupal).
Download the site's files into the directory created in step 1.
Add the files from the in the directory to the git repository by running this command in a terminal: git commit -am "First commit of Drupal files to repository."
There's a good help page about working with Drupal in git on drupal.org.
Create and populate your database.
Get a database dump from the live site.
Create a new database and database user on your machine.
Import the database dump into your new database.
Record the database credentials in settings.php or settings.local.php and store them somewhere safe, preferably in a password manager.
Change the database credentials in settings.php or settings.local.php to match the credentials of the database you've just created.
(For safety and to avoid confusion, I always create local databases with a different name, user, and password than the live site has. This means if your local credentials are compromised, the live site isn't, and it means you can't connect to and change the live site's database by accident.)
Set up the webserver in XAMPP
Create a new site in XAMPP called e.g. example.local that points to the directory that contains the file index.php
Add the following line the file called /etc/hosts on your computer:
127.0.0.1 example.local
Test that this works in a browser by visiting e.g. http://example.local or http://example.local/robots.txt.
Move your local changes to the Production site
How you will be able to do this depends to some extent on your client's web-hosting infrastructure, and what version of Drupal your client uses. but in any case, you will have three separate concerns for changes you make:
Code changes
You will need to deploy changes you make to the code back to the server. Ideally you would probably do this via Git either by cloning directly into the live site or (far better!) as part of an automated build process. By the sound of it, you may just have to FTP the changes back up.
Be careful not to re-upload your modified settings.php or settings.local.php file!
Content changes
You probably have to test some/all of your content changes locally and then recreate them on the live site. Because your client may have made changes to the live site while you were working, you can't risk importing your local database into the live site.
Configuration changes
Changes to configuration should be managed in code (i.e. as part of 1. Code changes above) if that's possible. In Drupal 7, the Features module is usually the best way to accomplish this (here's an answer I wrote describing the Features workflow). Drupal 8 has the Configuration Manager. Be aware that these two tools can both be tricky to use well.
Your client needs to gave you access to the files so you can put them into htdocs on XAMPP, then you need the database (also provide by the client), start XAMPP, create a new database on localhost/phpMyAdmin and import the db of the site. On the proyect code go to sites/default/settings and change the db settings to your local settings. Then you can go to localhost/{your-proyect} and it should work.

How to upload SQL database in hosting?

I'm new to website hosting.
I had successfully uploaded the files, now I want to upload database, can anybody help me to upload database from my localhost to my hosting website.
Use following step:
Go to cpanel.
create database by going to database option in cpanel.
assign db user to that database.
now go to that phpmyadmin.
export local db.
now import on live db.
Set home url and site url in option table.
work is done.
Generally all hosting services offer PhpMyAdmin. You can save your localhost database as local .sql file and import it on the server database.
PhpMyAdmin takes care of adding the commands to create the tables, so it is pretty easy.
You can find more details in the PhpMyAdmin docs.

Connect to a non locally hosted database when using MAMP?

im looking to launch a site soon that will have lots of user data on it.
For easier testing and uploading etc for changes i want to know if i can work on my MAMP site, whilst using directly the database from the live site?
Thanks.
I recently used MAMP and my database connected fine from one at the hosting company (not locally) if you use Joomla you can change the configuration.php file to point to your live database.

Importing MySql Database to online web hosting site?

I'm doing this website and I first tested it locally. Everything works including the database. The form from the html automatically sends submitted data to my database. The problem is, I want to host it online. I already have the website. I use webfreehosting.net. How can I insert my database to the file manager? I checked out the mysql manager and it says it imports text files. But the database folder on my local disk has opt and frm files only.
It looks like you are just starting out with web development. There are better, safer and faster ways to take MySQL dumps, but I would suggest you start with a graphical interface that aids in learning.
Your hosting provider would have provided you with a control panel. On their website, I can see that they provide phpMyAdmin. To import your database, you need to take the following steps:
Download a desktop MySQL administrator like MySQL Workbench
Export your database to a .SQL file
Log in to your web hosting control panel.
Create a Database.
Create a Database user and set a password for this
Grant this user all permissions to your database (not advisable, but its okay to start with)
Find phpMyAdmin. You will see this database listed.
Click on import and Import the database .sql file you created in step 2
Take a backup of your development database using mysqldump, then run the generated SQL against your production system.
Export your local database from MySQL Workbench in SQL format (text files). Then, import the same into online database using PHPMyAdmin.
How can I insert my database to the file manager?
You do not. If you made the website, you should know that you did not use it. Use phpMyAdmin for SQL.
Also, if you application is not working then check if you have made configuration changes in the file, like username, password.

Trouble migrating WordPress from local server to host

I'm having trouble migrating a Wordpress site I've been working on from my local machine onto a host.
I've been through the documentation and as far as I understand, I have to:
Export the wordpress database from my local server.
Edit the wp-config.php file to suit my target server.
Change the URL's in the settings to suit my target server.
Import the database on my target server and move over the adjusted wordpress installation onto my target server.
I can do all of this, but my there seem to be some problems: in my hosts phpmyadmin I can't view or edit any users and neither can I create any databases (there's no option for it). When I try to import a database I get an error: #1046 - No database selected.
What do I not know/doing wrong?
If importing a database, you need to create one first with the same name, then select it and then IMPORT the existing database to it.
I can do all of this, but my there seem to be some problems: in my hosts phpmyadmin I can't view or edit any users and neither can I
create any databases (there's no option for it).
If you're going through CPanel, you won't be able to add a database directly through PHPMyadmin. You should go to your host's home page and look for some wizard to create a database. (it should be next to the PHPMyadmin link.
Alternatively, for moving wordpress, You can install wordpress on your live site, then export your localhost content via Wordpress's dashboard and then import it on the live site.
This article on Moving Wordpress will also be helpful.

Categories