Skip to main content

Restore MySQL Database Without SQL Dump

Today in this article “Restore MySQL Database Without SQL Dump” we will discuss how you can restore your database when you don’t have SQL dump file.

This happens when your MYSQL gets corrupted. In that case, if you want to make a back up of your database you can simply copy following files and then restore them after a fresh installation

Let’s Start

Generally MySQL gets installed on following location
/var/lib/mysql

On this location it create folders of your databases. For instance, if you have databases like test, test1, test2

Then on this location /var/lib/mysql – You will have three folders test, test1, test2.

And each of these folders will contain database files for the MyISAM database.

It will have three main files with the following extensions

  • frm
  • myi
  • myd

And another three files which will be inside in /var/lib/mysql. These files are for INNO DB database.

  • ibdata1
  • ib_logfile0
  • ib_logfile1

Steps:

  • Stop Mysql Service using – sudo service mysqld stop
  • Copy folder to /var/lib/mysql using – sudo cp -R test /var/lib/mysql
  • Copy inno db files using – sudo cp ibdata1 ib_logfile0 ib_logfile1 /var/lib/mysql
  • Make sure ownership is set to mysql. Check ownership using.
    sudo ls -al
  • Set Ownership using following syntax
    For Files – sudo chown user:group files
    Ex: sudo chown mysql:mysql ibdata1 ib_logfile0 ib_logfile1

    For Folders – sudo chown -R user:group folder name
    Ex: sudo chown -R mysql:mysql test
  • Start Mysql Service – sudo service mysqld start
  • Now you will able to see your databases. πŸ™‚

Note:

For Centos and Fedora Based OS
sudo service mysqld stop
sudo service mysqld start


For Debian and Ubuntu OS
sudo service mysql stop
sudo service mysql start

Also check Reset MySQL Root Password

If you have any questions related to this article. Please leave it in comments.

And if you liked this article then please do like and share this post.

Thanks for reading πŸ™‚ πŸ™‚

Comments

Popular posts from this blog

Automation - Update Naukri Profile Using Selenium

Recently one of my friend came to me with a problem. He is looking out for new job but he feels quite boring to update  his profile on daily basis. As some people says updating profile in the morning gives you more calls as it keeps the newly updated profile on top (Although i don’t know whether naukri works this way or not πŸ˜€ ). As i was more interested to solve his problem.  After listening his problem i came to solution that instead of updating it manually lets make this job automatic. And it is quite interesting how we can automate our daily boring task with automation. Another day i came with the solution . And the solution was to make it automatic using selenium (Those who are not aware about selenium do check this link) In short, Selenium is a Testing automation Framework. And it is for automating web applications for testing purposes, but is certainly not limited to just that. Boring web-based administration tasks can (and should) also be automated as well....

OpenCV - Image Filters

Hello Guys, In this tutorial, I will discuss the color map in OpenCV. Color Map is used to show different color temperatures. And this can also be used to generate some cool image filters.  OpenCV comes with thirteen built-in color maps. So in this tutorial, I will show you how to use color maps.  Let’s get started List of Color Maps COLORMAP_AUTUMN COLORMAP_BONE COLORMAP_JET COLORMAP_WINTER COLORMAP_RAINBOW COLORMAP_OCEAN COLORMAP_SUMMER COLORMAP_SPRING COLORMAP_COOL COLORMAP_HSV COLORMAP_PINK COLORMAP_HOT COLORMAP_PARULA To apply color map first we need to convert an image to grayscale. So I will use  img = cv.imread("nature.jpg",cv.IMREAD_GRAYSCALE) If you are not aware of this function then please check my previous tutorial  http://techievaibhav.in/2019/01/10/reading-an-image-using-opencv/ To apply color maps, OpenCV comes with a function called applyColorMap() . This function takes two parameters. Gray Scale image Color Map Autumn Bone Cool Hot HSV Jet Ocean Parula Pink ...

Android - Show A Dialog From Service

In this article, I will be discussing how you can create a dialog from service. As we all know that service in android does not have any UI and it is intended for long-running background tasks. But sometimes it is required to show some information to the user when your app is running in the background. Today I will show you how you can implement this type of functionality in your application. Before starting the tutorial let me tell you about the special permission that we are going to use. Permission AndroidManifest.xml<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> This permission allows the app to use the system level window. AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.app.dialogfromservice"> <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> <appl...