How to empty a mysql database. Forget about delete * command
#!/bin/bash mysql -D $DATABASE -e 'TRUNCATE TABLENAME;'
Tag: mysql
-
Empty a database table command
-
Get MySQL options with my_print_defaults
my_print_defaults displays the options that are present in option groups of option files
my_print_defaults mysqld
-
MySQL Server Status in plesk
Get information about your mysql server. Uptime, threads, slow queries,…
mysqladmin -uadmin -p`cat /etc/psa/.psa.shadow` status
Uptime: 16203737 Threads: 1 Questions: 101442770 Slow queries: 1359 Opens: 3857138 Flush tables: 1 Open tables: 64 Queries per second avg: 6.260
-
How to rename a mysql database or table
Here is a dirty script to rename a mysql database or table from command line. Dont for get to stop mysql service!
cd /var/lib/mysql/
/etc/init.d/mysql stop
# rename database...
mv olddbname newdbname
# ...or table
cd database/
mv oldname.frm newname.frm
mv oldname.MYD newname.MYD
mv oldname.MYI newname.MYI
/etc/init.d/mysql start