linkTDP
2/8/2016 - 2:14 PM

Mysql tricks

Mysql tricks

# show tables

show tables;

# show indexes

show indexes from <table>;

# dump schema without data

mysqldump -u root -p --no-data dbname > schema.sql

# dump data without shcema

mysqldump -u root -p --no-create-info wiki > data_wiki.sql

# shell script for loading multiple sql files

for i in *.sql
do
  echo "file=$i"
  mysql -u admin_privileged_user --password=whatever your_database_here < $i
done





# load index in memory

SELECT COUNT(*) FROM tbl_name FORCE INDEX(key_name)