Issue with setting tables remote ClearDB (heroku) database - mysql

I'm trying to migrate my app from a Cloud9 IDE to the Heroku platform. I'm able to serve up the page no problem but the page isn't loading any of the info that was supposedly migrated over. I'm not seeing any error messages, nor do I know how to check if the tables were created properly in ClearDB.
How do I make sure my tables were created properly and the data was loaded?
The following steps were taken:
-Get remote MySQL setup on Heroku with the ClearDB Ignite variant
-Change the database connection in my Express server to the credentials of my Heroku app (if/else that looks if CLEARDB_DATABASE_URL exists and connects using the Heroku app url)
-Dumped the database tables into a file and ran the file on the remote db:
-- mysqldump -uroot --no-data > tables.sql
--mysql -h"us-cdbr-iron-east-04.cleardb.net" database < tables.sql

Ok. I figured it out. It looks like I exported the just the tables, not the entire database with values. I did a mysqldump for the entire database and then pushed it to heroku and everything appeared.

Related

How to reconnect from workbench to heroku app?

I have made a React+Node application with MySQL database. I'm using Heroku to deploy my application, and have done so successfully. However, I'm having problems with using my database on Heroku. Locally I'm using XAMPP and phpmyadmin for all database work.
In Heroku, I've used a clearDB add on to support MySQL and have gotten all necessary credentials in the format:
mysql://DB_USERNAME:DB_PASSWORD#BD_HOST/DB_DATABASE?reconnect=true
I've used MySQL Workbench and have created a database using the above supplied host name, username, password and have successfully connected the database to the app. But after a while i changed (on PhpMyadmin) the database structure and i deleted the connection from workbench panel. I tryied to make a new connection with the same Config Vars but the workbench send me an error of "Unknown Database nameOfDatabase".
There is something i missing? there is anything i have to do to delete the old connection for the new one to work?
thanks!

How to switch from MySQL to Postgre on Heroku

I want to host a django project on heroku. Locally, I developed it using MySQL database. And I have also pushed it to heroku but I get an Error message whenever I run heroku open command on command prompt. The error message is Can't connect to local MySQL server through socket. Though I'm a newbie in using databases, the way I understand the error is that heroku can't connect to local MySQL server which I'm using for local development. I don't want to connect to a remote MySQL database, instead, I want to connect to Postgre database just as heroku recommended.
Being a newbie in the use of database, I don't know the best way to migrate to Postgre or how to add MySQL in my project to .gitignore. Is it possible for me to start running Postgre on heroku while MySQL isn't added to . gitignore and is still the database in settings.py? Must I clear MySQL database or add it to gitignore before I can use Postgre?
PostgreSQL settings for Heroku:
Please install dj_database_url using below command:
pip install dj-database-url
In settings.py , import dj_database_url and add below settings at the end of the file:
import dj_database_url
db_from_env = dj_database_url.config(conn_max_age=500)
DATABASES['default'].update(db_from_env)
Done !! Now, deploy again to Heroku.

MySQL Not loading Database File from /usr/local/mysql/data

Hey Guys so the other day I was running a database schema in the mysql workbench on my mac. I had added tables populated the data and tried to run some big queries. The server died and now when I connect to my local host instance I cannot find my database. However I can still see my database file in /usr/local/mysql/data/
Can any one help me work out how to start mysql server again and get it to load in the file?
I just dont' understand why it can no longer see the schema..
Connecting as localhost, using root, both workbench and terminal can't see the file. However the file is here:
The file I want is AM_DUMPS
When I try and load it from SQL Workbench I get:
Check to see if the data directory is owned by MySQL or mysqld is not launched as the mysql user. It looks like something along those lines. You may have to adjust the permissions to make sure that mysql is the owner.

Restore .sql export to WordPress db from within WordPress?

I've been developing a client's site and have maintained .sql backups using Export of phpMyAdmin. Yesterday my client provided me with credentials for the destination server and asked if I could migrate the development site to the beta site.
I can copy the files, of course, and I have changed wp-config.php to point to the new database correctly. When I load the page initially a default WordPress installation is created.
Unfortunately, I was not provided cPanel or phpMyAdmin credentials.
Ideally, there would be a plugin or script that would drop all of the existing tables created by default and use my .sql export to recreate the tables and populate them with data.
Does anyone know if there is a way to import this .sql from within WordPress?
You can import it with mysql on the command line:
mysql -u someuser -p password <yoursqlfile.sql
Or you can open it in mysql workbench (download from mysql.com) and run it from there.
In case you cannot SSH to the server or access the database via workbench as Norbert suggested, you can try XCloner.
It would be better if you had some sort of direct access to the database, but I'm guessing if you do not have cpanel access you also do not have SSH access. It is also common for databases to be restricted to local access, so a remote connection via MySQL Workbench may not be an option.
If for whatever reason none of these solutions work, you can temporarily connect the site to a remote database that you have access to until you get the necessary credentials from the client.

How to push my Mysql database to heroku via mysql workbench?

I have created cleardb on heroku, I want to push my mysql database on local disk to heroku. I have mysql workbench installed. How can i push it to heroku ?
look at the output of heroku config - you will see an key called CLEARDB_DATABASE_URL this is the connection string your application uses to talk to your database.
You can take this URL and break it up into it's constituent parts to get a username, password, host, port and database name which you can use in a connection via mysql workbench.
See https://devcenter.heroku.com/articles/cleardb for further reference.
If u want to just push your database, use console, it's simple:
heroku db:push