1

I find manually editing MySQL databases tedious.

If the whole database was optionally represented as text files (as per Unix "everything is a file") for quick manually edits, searching and replacing would be much simpler.

Is it possible to represent MySQL database as text files?

Background:

A user asked to get something deleted from the forum database. Haven't found out how to search and delete it.

  • As PatomaS said, doing this is not a good idea. Which forum are you using? If it's phpBB, I should be able to help. – Ivo van der Veeken Feb 17 '14 at 9:27
  • 2
    How do you currently edit/manage MySQL databases? Do you do everything on the command line, or use a GUI such as phpMyAdmin? – MrWhite Feb 17 '14 at 14:43
3

You can export the database information as many text formats like CSV, JSON, TXT, SQL, etc.

But usually databases are more complex than just the information contained there, for instance, there may be dependencies between tables, autoincrement fields, foerign key restrictions, etc. If you just edit the exported text, you may be breaking some of the functionality or the data stored the database.

I seriously advise you not to do that can of external edits unless you are 100% sure of what you are doing and the data you are manipulating.

2

This sounds like you would benefit from a GUI to do this for you... However some one would need to build that for you (assuming you're not a developer).

Exporting to a different format is not advisable in most cases as if your database is relational or has any constrains, then editing without having these rules enforced will likely cause issues and prevent you from inputting your changes...

Since you wrote Haven't found out how to search and delete it. you'd use the following syntax

DELETE FROM MyTable WHERE MyColumn="The Value";

Of course, if you have a relational database then it may not be that simple as this could leave orphan's all over the place.

1

mysqldump is a database backup tool that can export the entire database to a single text file. You could use the Unix commands on that text file, and then use it to recreate the database.

1

It depends on your goal. If the goal is to delete message on your forum, the best idea is to manage it under the forum backend. Normally, each forum backend tool has a way to moderate all user actions.

I do not advise you to change directly contents directly from database. The data integrity may be corrupted following such direct database manipulation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.