Tuesday, June 18, 2024

Some MySQL tricks that could help you with your blog!

- Advertisement -spot_img
- Advertisement -Traffic Analysts Tool

Do it manually is the lesson we are going to attend today.
And because not everybody loves plug-ins or scripts to do what he will do, this post is to show you how to make some tricks directly from the source.



If you want to transform your links to NoFollow do this :

update wp_posts set `post_content` = replace(post_content, ‘<a href=’, ‘<a rel=”nofollow” href=’)

- Advertisement -Traffic Analysts Tool


You can also use it to sell in content links.
A- Find the relevant anchor text

Select post_name, post_title, guid, from wp_posts where post_content like ‘%Your link  text%’;

This will give you the all the post that has this keyword.

B- Add hyperlink

update wp_posts set `post_content` = replace(post_content, ‘Your link  text’, ‘<a rel=”nofollow” href=”https://www.blogprocess.com” >Your link  text</a>’)


- Advertisement -Traffic Analysts Tool

Having a large MySQL database make it very hard and sometimes impossible to backup and restore using the conventional phpmyadmin or any other program.But moving your website should not stop at this point.

First you need to have shell (ssh) access to your server.And you can use any free program like Xshell, Tunnelier or PuTTY to connect your server Then follow the steps:

[dbuname] : is your database username.
[passW] : is the password for your database (note there is no space between -p and the password).
[dbname] : is the name of your database.
[backup.sql] : is the file name for your database backup.

A- To Backup Mysql Database

$ mysqldump -u [dbuname] -p[passW] [dbname] > [backup.sql]

B- To Backup Mysql Database with compress

If your mysql database is very big, you might want to compress the output. Just use the mysql backup command below and choose the output to gzip, then you will get it as gzip file.

$ mysqldump -u [dbuname] -p[passW] [dbname] | gzip -9 > [backup.sql.gz]

C- To Restore Mysql Database
To restore the database you need to create the database in target machine then use this command

$ mysql -u [dbuname] -p[passW] [db.to.restore] < [backup.sql]

D- To Restore Compressed Mysql Database

gunzip < [backup.sql.gz] | mysql -u [dbuname] -p[passW] [dbname]

- Advertisement -
Latest news
- Advertisement -

Liquid Web Storm VPS
Related articles
- Advertisement - Traffic Analysts Tool