 Hello there, welcome back to DanielRosell.Tech on YouTube Medium and at DanielRosell.Tech. So in my main video on backing up shared hosting environments to a Linux file system, now it doesn't actually really make a difference what OS you're backing up to, but there is a problem when you're trying to back up a shared hosting environment. Now, if you just need to back up a static website, whether that, you know, a website with static files, then you can simply back up the file system, and I described how to do that in this, in this Medium post that's on Medium, Daniel's Tech World. Look for the how to back up shared hosting onto a Linux host post, and basically you can just use R-Sync and simply SSH, and this is, this assumes that you have SSH access to the remote server. You can just use R-Sync with a few operators here, connect into the remote server, your domain at the server, public IP, and then just back up, choose the path to back up. So this in a typical shared hosting environment, the path is going to look something like home, forward slash, your domain, forward slash, public HTML, now this is important because that's where, that's where typically in shared hosting all the, that from this directory and above is exposed to the public internet. So typically if you just capture here, so you can see there's a trailing slash, so everything beyond public HTML will be backed up, and then just pick a local path, so you can run this script on a NAS, or you can run it on a Linux computer, for instance, and you can just put that as a cron job, and that will automatically back up a file system. Now the only problem is if you are using, and I mentioned this in the backing up shared hosting video, if you're using something like a WordPress website, so that application obtains obviously both a file system and a MySQL database, so in order to create a backup of that, we are going to want to back up the MySQL database as well. So I described that in this post when, when you're in shared hosting, you have access to this part of the file system, so it's above home. Now you don't back up a MySQL by backing up the actual database, but there is a utility called MySQL dump, which you can use. Now if you look through the documentation on the MySQL website, you can see that there is a way to do MySQL dump and append this all databases, and that will actually dump, and MySQL dump is a utility for creating export backup exports that you can then use to restore, or it can be used for that purpose. So you can see here, you can use, if you want to just do it for a single database, you actually can omit this tag, tag databases. You can just do the syntax, it's pretty simple, MySQL dump, the database name, this, you know, forward arrow, and then the export, so, and then there's a couple more things you need to append to that to get the username and the password. So if we look here, so this is the syntax I've written out for typical WordPress database, MySQL dump minus U, and this is the MySQL user, minus P, single quotation marks, and then the MySQL password. Now the interesting thing is that looks wrong to a lot of people, including me, that there's no space between the minus P, and that's I'll see for password, and the password in single quotation marks, that is correct, you need to have no space there. Then this is the database being backed up, then as I said, the forward arrow, I'm sure there's a better word for that, I think it's a carous, and then the full path, an important here, the full path that you want the back, where you want the backup to go. So if you are looking to use this process to back up a WordPress database, and the MySQL database for a particular WordPress site, then it's simple way to find your username, the MySQL username, the MySQL database name, and the MySQL password, all that information, it's simply towards the top of my WPconfig.php, so go to wherever your WordPress is installed, navigate to the WordPress root directory, and just inspect WPconfig.php, and I've just copied and pasted the first few lines, and just obviously scrambled these credentials. So we can see here, if we zoom in, MySQL settings, we have the database name, we have the MySQL database username connecting to the database, and we have the password, which I've obviously changed here, so that's actually enough information. These two are the same, so we can just copy to the top of our clipboard over here the database name and the username, and our dummy passwords, and we can just put these towards the top like this. Next thing I would go ahead and do is I'm just going to copy the command onto the clipboard because that command is actually good enough just to back up the database basically, so I'm just going to copy that now in my C panel and going into my cron job manager over here, and I just want to then enter, go down to the bottom, and I'm going to enter the command. Okay, so basically I'm just going to paste in the command, and now we just simply need to change, swap out what was in this example, so MySQL dump minus U for user, and our user is going to be the MySQL user minus P, and we have to be careful here because we need to preserve their quotation marks, and we need to not introduce a space, so overriding what's between those quotation marks with our actual password, and we can just copy directly here from the user to the database because in this case they are the same. Very, very simple syntax, and then the output format is, as you can see, home your domain backup daily MySQL backup.sql, so basically what I would do is go into file manager, and I just created a folder there called backup, and that's where I'm going to dump out this daily MySQL backup. Now, of course, it's just important to make sure that the where your dump is going to go is not in, so you wouldn't want to put it in anywhere at or above public HTML because then it would be publicly accessible, so just want to make sure that it's not in a publicly accessible part of the web server. Then you want to simply add this as a job and what I want to do, so this video compliments my backing up shared hosting via arcing video, so I'll put a link to that in the description, but let's say you're running that job every 24 hours, so you simply want to have this running at some interval that's more frequent. For example, if the backup job runs at midnight, you might want to back this up at 11 p.m. because the MySQL dump doesn't produce a particularly huge file, I would just do it in a more frequent interval, so for example, that could be minute zero every 12 hours, every day, every month, and every weekday, and then just add that as a cron job, and then in the top then this is kind of the nicer cron manager you get in cPanel, and it gives you the option to set up an email address to send the output of the job, or you can obviously suppress the output by using the dev, not to send at the end of the command, so then just click on add new cron job. So just click the button and I can see that this is running every 12 hours, a minute zero of the hour, every day, every month, every weekday. It's running the MySQL dump command, and it'll back up the WordPress database of, and just make sure, as I said, that because if you have shared hosting and a bunch of WordPress installations, you just want to make sure that you're backing up the right database, and to do that you just need to go into WP config. You can of course do this in other ways, you can go into the PHP, the MySQL database inspector, but this is quick and easy, and then it'll output this here, so you just then want to make sure that when you're building the rsync command, or commands if you want to do it separately, that you back up, you also bring in the database into your backup, by backing up the backup folder, and then you'll have both the file system and the database, and I actually did recently do a test restore on a MySQL database backed up using this method and it worked perfectly, so I can just confirm that this simple one line, MySQL dump command works for the purpose of restore ability, so that's just basically the procedure for adding the MySQL backup to the file system backup when you are creating a manual backup of a shared hosting environment onto, as I said, a Linux host, but it can also be a Windows host because there is a way to interface using rsync on that too, and of course the beauty of rsync is that it's incremental, although the MySQL backup here will actually overwrite the file every time that it runs, but you're not talking about big data generally in the MySQL for small WordPress installation, so I hope that video has been useful, any questions or comments I'm available at DanielRosal.com, look forward to bringing another video out onto this channel soon.