U
U
userAnatolio2018-11-04 19:46:39
MySQL
userAnatolio, 2018-11-04 19:46:39

How not to accidentally delete a database?

How to make a request correctly so as not to delete the database, I heard that some people manage to delete the database with the help of an erroneous request, how is it?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
V
Vladislav Klimanov, 2018-11-04
@userAnatolio

Make backups and limit the rights of the user from which requests are made :)

L
longclaps, 2018-11-04
@longclaps

In such matters, knowledge is acquired through personal experience.
Once you delete the base, another one - and then you will get used to it .

V
Vladimir Druzhaev, 2018-11-04
@OtshelnikFm

Drop, delete
In general, when starting work with the database, it's better to make a backup - this is one time
Two - do not hone your requests on the prod. Even if it seems to you "ah, now I'll choose a bit here ..."

M
mletov, 2018-11-06
@mletov

1) Carefully check WHERE conditions for UPDATE and DELETE. It is better to do a SELECT with this WHERE first, and only then execute a change / delete query
2) If there are a lot of tables, fields and data in the database, then before changing the database structure (for example, deleting / renaming columns), it is better to make a backup. It happens that it seems that he didn’t do anything criminal, well, he deleted the column, or there wasn’t enough memory somewhere, or something was locked up somewhere, but the table was cleared.

N
nrv, 2018-11-06
@nrv

I do not know how to delete the database (there was no such task ever). Drop table, full cleanup of truncate table records. Perhaps bases are created and dropped in much the same way as tables.
In general, you can make a serious mistake with a big loss of data if you do a lot of work with your hands - clean the database, delete all sorts of some_table_dev, some_table2, some_table_backup, you can copy-paste something in the wrong place and delete the table. Or automation, some kind of script that drops or trunks something.
If you only select - you write, you can’t delete anything, the moral is this)) To delete the base, you need to run the code that deletes the base (maybe you think that it’s the wrong base, and this is the danger). If you do not know how to delete the database, you will not be able to delete it (from sql), unless you start something from the Internet.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question