User Tools

Site Tools


mysql

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
mysql [2009/08/04 05:18] suapapamysql [2013/08/03 05:04] (current) – external edit 127.0.0.1
Line 2: Line 2:
 <code python> <code python>
 import MySQLdb import MySQLdb
-postCnt = cursor.execute('select id,post_content from wp_posts') #434L 
 db = MySQLdb.connect(db='dbname', user='username', passwd='password', host='localhost') db = MySQLdb.connect(db='dbname', user='username', passwd='password', host='localhost')
-cursor = db.cursor()+#cursor = db.cursor(
 +cursor = db.cursor(MySQLdb.cursors.DictCursor)
 #(필드명,데이터형_코드, 표시크기, 내부크기, 정확도, 비율, nullable) #(필드명,데이터형_코드, 표시크기, 내부크기, 정확도, 비율, nullable)
 cursor.description #(('id', 8, 3, 20, 20, 0, 0), ('post_content', 252, 9933, -1, -1, 0, 0)) cursor.description #(('id', 8, 3, 20, 20, 0, 0), ('post_content', 252, 9933, -1, -1, 0, 0))
 +postCnt = cursor.execute('select id,post_content from wp_posts') #434L
 </code> </code>
 +
 +<img src="/wordpress/wp-content/uploads/2008/01/sfxn_in_t2_01.jpg" 
 +
 ===== references ===== ===== references =====
   *[[http://kwon37xi.springnote.com/pages/750237|Python MySQL]] from 권남이님의 스프링노트   *[[http://kwon37xi.springnote.com/pages/750237|Python MySQL]] from 권남이님의 스프링노트
Line 27: Line 31:
 mysql> EXIT mysql> EXIT
 </code> </code>
 +모든 테이블 지우기
 +<code mysql>
 +mysqldump --single-transaction -uID -pPASS --add-drop-table --no-data DB_NAME \
 +| grep ^DROP \
 +| mysql -uID -pPASS DB_NAME
 +</code>
 +
 ====== blog restore ====== ====== blog restore ======
 <code mysql> <code mysql>
Line 41: Line 52:
 Rows matched: 1  Changed: 1  Warnings: 0 Rows matched: 1  Changed: 1  Warnings: 0
  
-mysql> select option_name,option_value from wp_options where option_name='siteurl';                       +-------------+---------------------------------------++mysql> select option_name,option_value from wp_options where option_name='siteurl'; 
 ++-------------+---------------------------------------+
 | option_name | option_value                          | | option_name | option_value                          |
 +-------------+---------------------------------------+ +-------------+---------------------------------------+
mysql.1249363094.txt.gz · Last modified: 2013/08/03 05:04 (external edit)