Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uploading a database to GitHub

Tags:

github

mysql

I'm recently applying for a job and the employers need to see my repositories in GitHub. Since they need a database to function, the database must be exported to GitHub.
I've seen a few answers in Stack Overflow but really none of them addresses my issues as they give pretty shallow answers. A comprehensive explanation of it would be ideal.

So my question is : "How do you upload a database in GitHub?" I'm using MySQL Workbench for my project.

like image 207
X HOxha Avatar asked Sep 05 '25 02:09

X HOxha


2 Answers

Typically projects on GitHub don't come with a database, but they include code to initialize a database. For example, you can dump the contents of a MySQL database with the mysqldump tool. See https://dev.mysql.com/doc/refman/5.7/en/using-mysqldump.html

The project on GitHub has instructions for loading that data into a database on the user's computer prior to running the application. The user is responsible for installing an instance of MySQL first.

Part of the reason for this is that different users are on different operating systems, and the database software or even the data files might need to be different for different platforms. So it's better to provide the mysqldump file which is in a format that is independent of platform, and can be loaded into a MySQL instance on any operating system.

A second reason is the redistribution license for MySQL Community Edition would obligate you to offer your own GitHub project under a license compatible with the GNU Public License (GPL). The way to work around this is to not distribute MySQL software itself, but distribute only your data, with instructions to reload it into MySQL that is installed by the user.

like image 63
Bill Karwin Avatar answered Sep 09 '25 02:09

Bill Karwin


Your best bet is to host your db on the cloud.

If you search for 'MySQL cloud hosting' you will find many cheap or free providers.

You could create a dump of your db and upload the file to GitHub but this isn't a very good idea for multiple reasons:

  • GitHub is meant for source code and documents - large binaries and db dumps will make operations such as git clone very slow.
  • Whoever wants to run your app will then have to set up a DB server on their local machine or elsewhere which is effort.
like image 34
Will Taylor Avatar answered Sep 09 '25 03:09

Will Taylor