php mysql update variable

Goal: Update wordpress post with PHP cli < ?php $con = mysql_connect("localhost","root","[redacted]"); if (!$con) { echo "Unable to connect to DB: " . mysql_error(); exit; } if (!mysql_select_db("wordpress")) { echo "Unable to select mydbname: " . mysql_error(); exit; } $myfileText = mysql_real_escape_string(file_get_contents('./code_for_wordpress.html',true)); $sql = "UPDATE `[your_instance_prefix]_posts` SET `post_content` = '$myfileText' WHERE `ID` like '1397';"; $result . . . → Read More: php mysql update variable

mysql insert cdn sync tool

To manually update the CDN Sync Tool table (for wordpress plugin CDN Sync Tool) try this MySQL Insert Statement:

Replace the id with the latest id on your table

Manually insert row to cdn sync table INSERT INTO `wordpressdb`.`prefix_cst_new_files` (`id`, `file_dir`, `remote_path`, `changedate`, `synced`) VALUES (1567,’/full/path/to/file/filename.txt’,'filename.txt’,’1345062888′,’1′);

To confirm your work:

SELECT * FROM `wordpressdb`.`prefix_cst_new_files` where . . . → Read More: mysql insert cdn sync tool

howto move mysql freebsd without dump

to move mysql on freebsd without using a dump file follow these steps:

stop mysql copy /var/db/mysql to its new location chown -R mysql:mysql modify /etc/rc.conf and add line mysql_dbdir=”“ modify /usr/local/etc/rc.d/mysql-server and change mysql_dbdir=”/var/db/mysql” to the new location of your mysql directory Start up mysql:  /usr/local/etc/rc.d/mysql-server start

rename mysql schema

How can you rename a mysql Schema?

easy!

Create the new schema

In this example the new schema is called my_new_schema

mysqladmin -u root -p create my_new_schema Dump the old schema and pipe in to new schema mysqldump -u root -p old_schema | mysql -u root -p my_new_schema

ssh port forwarding example

mysql_ssh_port_forward

A ssh port forwarding example would be to map a remote host’s 3306 port to your local machines 3306 port over ssh.

Remote Host: 192.168.0.1 Your Host: localhost

To port forward a mysql connection on a remote host to your local host you would run:

ssh -L 3306:localhost:3306 [email protected]

Once this is mapped you can . . . → Read More: ssh port forwarding example

convert ascii mysql db to utf8

how to convert ascii mysql db to utf8 ?

I had a MyISAM mediawiki 1.11.0 database that needed to be utf8 to upgrade to the latest version. Before I could upgrade it I had to convert it to utf8.

Here’s the steps on FreeBSD:

mysqldump -u root -p –default-character-set=latin1 -c –insert-ignore –skip-set-charset -r wikidb_latin1a.sql wikidb . . . → Read More: convert ascii mysql db to utf8

redmine all users projects query

Ever needed to get all projects associated with every user in redmine?  Here’s a query that will help

Multiple Joins sql query; To get user, all projects associated with user and role on that project.

 Exmaple:

Table

Column Names

. . . → Read More: redmine all users projects query

Redmine Alert on New Admin or Public Project

Problem: How can I receive an email when the Redmine admin list changes or a project is changed to publicly viewable? You will need to run some mysql commands / queries in windows batch mode.

Solution:

Download blat and place in c:\windows\system32 Create directory c:\1admin and place these files in it:

These are the queries . . . → Read More: Redmine Alert on New Admin or Public Project

Howto Backup your Bitnami Instance to a Remote Site for Free

Howto Backup your Bitnami Instance to a Remote Site for Free What you’ll need 1. Install dropbox to c:\My Dropbox 2. The names of the services bitnami uses (from command line type net start to get list of services) 3. A new local user in the administrator group that will just be used to run . . . → Read More: Howto Backup your Bitnami Instance to a Remote Site for Free