Table of Contents
How Do I Split My Existing Database into Tables?
To split your existing database into tables, you need to access your server via an SSH connection.
Once you have successfully connected through to an SSH connection, you need to go to your application folder by following these commands:
1) cd applications (enter)
2) type LS in small letters and hit enter to see all the application folder name
3) cd (type app folder name) enter
4) cd public_html
5) Go to that folder where you save your database dump and create another folder to split tables.
For example, we have created a dbdump folder in public_html and saved database dump in that folder, and split the tables in the same folder as shown below:
When you are in your destination folder, use the following command to split your existing database into tables and then hit Enter.
cat filename.sql | awk ‘BEGIN {output = “comments”; } $data ~ /^CREATE TABLE/ {close(output); output = substr($3,2,length($3)-2); } { print $data >> output }’;
Once you successfully run the above command, type ls to check all the split tables in the same folder.
That’s it! We hope this article was helpful. If you need any help, then feel free to search your query on Cloudways Support Center or contact us via chat (Need a Hand > Send us a Message). Alternatively, you can also create a support ticket.