Kategorie: MySQL

MYSQL: Default Basic Table Structure WordPress

If you use WordPress and have tested some plugins and removed them later, it is possible that you have much waste tables still inside your database. First do Database Backup with MySQL DUMP Then check it enter the mysql console as your mysql admin user and do: $mysql -u mysqladminusername -p mysql > use databasename; mysql > show tables; System echo: +—————————+ | Tables_in_wordpressdatab | +—————————+ | wp_commentmeta            | | wp_comments               | | wp_links                  | | wp_options                | | wp_postmeta               | | wp_posts                  | | wp_term_relationships     | | wp_term_taxonomy          | | wp_termmeta               | | wp_terms                  | | wp_usermeta               | | […]

WordPress: Change Word on all content sites with mysql

If you run a WordPress Blog or other CMS with MySQL Backend you can easy change one same word or expression on all content sites on the fly Do a mysqldump at first of the current database $ mysqldump -u username -p dbname > dbbackup.sql Login to the MySQL server Console Switch to the Database mysql> use dbname; run command for tests, lists touched posts mysql> SELECT * FROM wp_posts WHERE (post_content LIKE '%expression%'); Run Replace code to pre, cause i use preformat text plugin for the copy & paste boxes mysql> UPDATE wp_posts SET post_content = REPLACE ( post_content, […]

WordPress: Monitor the Size of the MYSQL Database

If you use WordPress or a other Blog Software with a MySQL Database over years it is useful to do some things regularly: Check the Database Size weekly, that no Skript Kid has found a Backdoor and fills up the Database silent Purge Database Caches with default maintenance tools of the Software Dont forget to create a MySQL Dump Backup weekly with cron To Check the Size login on mysql command prompt do: $mysql -u dbuser -p #Enter Password mysql > use dbwordpress mysql > SELECT table_schema "Data Base Name", sum( data_length + index_length) / 1024 / 1024 "Data Base […]

WordPress: Replace or Purge Text on all Posts by mysql

If you have to remove a link, text or else on all wordpress posts pages with same signs like the „read more“ tag do: mysql -u dbadmin -p – enter password – change database by: use databasename – run change command(SET „more-tag-source-html-pre“ WordPress reformat the output here! ): mysql > UPDATE wp_posts SET post_content = REPLACE (post_content,'<!!–more–>',''); – System Echo’s: Query OK, 88 rows affected (0.01 sec) Rows matched: 706 Changed: 88 Warnings: 0

WordPress: Move Blog to new URL Domain HTTP HTTPS on the MYSQL Console

Info: Today most Search Engines prefer Blogs who are offering „HTTPS“ at the URL for secure direct connects to the Websites but this results a lot of headaches to the Website Developers. To be effective you should know: You have to offer HTTPS beside HTTP You should use a validated Domain Certificate, most Domain Resellers offer them for FREE You should know that NOT every FREE Certificate is TRUSTED by every Browser (green closed lock symbol at the adressbar) You have to Develop Websites WITH variable Format output ( PC, Tablet, Smartphone, Smart-TV, Infoboxes,) Design Websites and test 3:2, 4:3, […]

PHPMYADMIN: Performance Monitor not working Java Script Error

If you install phpmyadmin on your Server Version 4.XX, the Browser shows a Javascript Error if the Performance Monitor is opened. Problem is the mostly the setting „localhost“ on the config.inc.php file. If you want to view the monitor from external, set the ip to 192.XXX.XXX.XXX or domainname and control that the MYSQL Server is listening on all IPs! Warning! If you dont really need this  tool DONT CHANGE the MYSQL Server IP to listening „ALL“ cause LOCALHOST is much more secure! Localhost should work if you have installed a local proxy on the Server! So you can relay the […]

MySQL : Backup and Restore Database without phpmyadmin (commandline)

Problem: phpmyadmin interfaces are slow and often attacked by script kids, if you can don’t use it! Solution: To backup and restore use command line To Backup a database: $mysqldump -u root -p wordpressdb > /backups/wordpressdb-dump.sql [Enter root password] To restore: $mysql -u root -p wordpressdb < /backups/wordpressdb-dump.sql[Enter root password] Remark: this is not recogized by the ONLINE SYSTEM if users visits you pages to read! There must be no shutdown of the mysql or apache webserver, its a online HOT-Dump. If you like put it into a script and set cron to backup every night. Sample Bash MySQL Script […]

WordPress MySQL: Cleanup old revisions old posts old entrys

Problem: If you use wordpress and edit often your posts a high count of old revisions are backuped inside the mysql database: Solution: Login mysql $mysql -u root -p [Enter root password] at mysql command line select wordpress your database mysql>use wordpressdb; [Enter] System echo=Database changed.. delete old backups of posts mysql>DELETE FROM wp_posts WHERE post_type = "revision"; [Enter] System echo=..Entry affected time.. logout database and revisit pages, if you have made a database backup with mysqldump before and after cleanup you see how much size the database lost (du -h wordpress.sql) often 80% of the size.