Create table if not exists from mysqldump

Try to use this on your SQL file:

sed 's/CREATE TABLE/CREATE TABLE IF NOT EXISTS/g' <file-path>

or to save

sed -i 's/CREATE TABLE/CREATE TABLE IF NOT EXISTS/g' <file-path>

it’s not ideal but it works 😛

Leave a Comment