Difference between revisions of "Mysql"
From Wikifications
(3 intermediate revisions by the same user not shown) | |||
Line 14: | Line 14: | ||
select user_id, user_name, user_real_name, user_email from wiki_user; | select user_id, user_name, user_real_name, user_email from wiki_user; | ||
select * from wiki_user where user_name = "Dre"; | select * from wiki_user where user_name = "Dre"; | ||
+ | select local_data_id,host_id,hostname,arg1 from poller_item where hostname = "eastman.apple.com" order by local_data_id; | ||
'''List all user-contributed wiki stories''' (in this wiki, cur_id of user contrib'd pages starts at 928) | '''List all user-contributed wiki stories''' (in this wiki, cur_id of user contrib'd pages starts at 928) | ||
− | select cur_title from wiki_cur where cur_id > 927; | + | select cur_title, cur_id from wiki_cur where cur_id > 927; |
'''Show text of an entry''' | '''Show text of an entry''' | ||
select cur_title, cur_text from wiki_cur where cur_id = 930; | select cur_title, cur_text from wiki_cur where cur_id = 930; | ||
+ | |||
+ | '''Edit some data''' | ||
+ | update phpbb_config set config_value = 10 where config_name = 'max_login_attempts'; | ||
+ | |||
+ | '''Backup / Restore''' | ||
+ | mysqldump -u user -h db.host.com -p database > dump.sql | ||
+ | mysql -u user -h db.host.com -p database < backup-file.sql |
Latest revision as of 17:22, 30 April 2007
Connect to a db host:
mysql -u user -h db.host.com -p
List databases:
show databases;
Move into a db and list tables:
use foo; show tables;
Examine data:
DESCRIBE wiki_user; select user_name from wiki_user; select user_id, user_name, user_real_name, user_email from wiki_user; select * from wiki_user where user_name = "Dre"; select local_data_id,host_id,hostname,arg1 from poller_item where hostname = "eastman.apple.com" order by local_data_id;
List all user-contributed wiki stories (in this wiki, cur_id of user contrib'd pages starts at 928)
select cur_title, cur_id from wiki_cur where cur_id > 927;
Show text of an entry
select cur_title, cur_text from wiki_cur where cur_id = 930;
Edit some data
update phpbb_config set config_value = 10 where config_name = 'max_login_attempts';
Backup / Restore
mysqldump -u user -h db.host.com -p database > dump.sql mysql -u user -h db.host.com -p database < backup-file.sql