Difference between revisions of "Mysql"

From Wikifications
Jump to: navigation, search
(initial rev)
 
Line 6: Line 6:
  
 
'''Move into a db and list tables''':
 
'''Move into a db and list tables''':
  user foo;
+
  use foo;
 
  show tables;
 
  show tables;
  

Revision as of 17:07, 17 April 2005

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";

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;

Show text of an entry

select cur_title, cur_text from wiki_cur where cur_id = 930;