Archive for the ‘mysql’ Category

SELECT DISTINCT CONCAT (‘show grants for `’, user, ‘`@`’, host, ‘`;’) AS query FROM mysql.user;

For this exercise, we will use the mysqldump utility the same as if we were backing up the entire database.

Syntax:

$ mysqldump -d -h localhost -u root -pmypassword databasename > dumpfile.sql

The only option that is different than creating an entire backup is the -d switch, which tells mysqldump not to output the data.

Example:

$ mysqldump -d -h localhost -u root -p2Uad7as9 database01 > dumpfile.sql

source http://www.howtogeek.com/howto/programming/mysql/dump-just-the-table-structure-to-a-file-in-mysql/

SELECT mail.id, mail.mail_name, domains.name, accounts.password, mail.postbox, mail.mbox_quota, mail.redirect, mail.redir_addr, mail_group, mail.autoresponder FROM mail, accounts, domains WHERE mail.account_id = accounts.id AND mail.dom_id = domains.id AND domains.name = ‘domain.tld’;

http://lerdorf.com/veracruz.pdf

http://www.linuxscrew.com/2009/12/21/best-of-linux-cheat-sheets/

/usr/bin/mysql_secure_installation

[mysqld]
default-character-set=utf8
default-collation=utf8_general_ci
character-set-server=utf8
collation-server=utf8_general_ci
init-connect='SET NAMES utf8'

[client]
default-character-set=utf8

set all to utf8 in my.cnf

1. Log in as root in SSH.
2. Type mysql -uadmin -p`cat /etc/psa/.psa.shadow`, and then press Enter.
3. Type use psa;, and then press Enter.
4. Type select * from sys_users;, and then press Enter.
5. Type select * from accounts where id = 2;, and then press Enter.
A table displays that shows the id, type, and password for accounts where the ID = 2.

SELECT accounts.id, mail.mail_name, accounts.password, domains.name FROM domains LEFT JOIN mail ON domains.id = mail.dom_id LEFT JOIN accounts ON mail.account_id = accounts.id