Ubiquity MySQL Documentation Search Commands

I love writing these Ubiquity commands, here are some MySQL search commands that I'm sure will come in handy down the road..

The Commands:
  • mysql: Search all of the MySQL documentation.
  • mysql5: Search the MySQL 5.0 reference manual.
  • mysql5.1: Search the MySQL 5.1 reference manual.
  • mysql6: Search the MySQL 6.0 reference manual.
  • mysql-admin: Search the MySQL administrator reference manual.
  • mysql-query-browser: Search the MySQL query browser reference manual
  • mysql-migration-toolkit: Search the MySQL migration toolkit reference manual.
  • mysql-workbench: Search the MySQL workbench reference manual.
Go here to subscribe.

How to Connect to MySQL with R in Wndows (using RMySQL)

This is a quick step-by-step guide on how to connect to MySQL via R. If your wondering why you might want to do that, think of all the math that could be done in R, the results of which could be saved into a MySQL DB.

RMySQL is the R package that you will need to connect to MySQL; it was made by Omegahat.

Steps:

  1. Open RGui (Assuming you have installed R already).
  2. Goto Packages -> Install Package(s)...
  3. Pick a server at a location near by.
  4. Choose 'RMySQL' and install.
  5. Run the following commands to connect:

> library(RMySQL)
> drv = dbDriver("MySQL")
> con = dbConnect(drv,host="mars",dbname="sat133",user="sat133",pass="T0pSecr3t")
> album = dbGetQuery(con,statement="select * from tasks")
> a

In the query above, if the host, database, username, and password all exist, then the code above should return a table of results =]

How to setup and run MySQL in Cygwin

First, download and install MySQL Community Server (you need this for the command line tool, so make sure when your asked, to include this in the windows path).

Second, make sure that the path to MySQL (usually something like: /cygdrive/c/Program Files/MySQL/MySQL Server 5.0/bin) is in the $PATH of Cygwin.

That's it!

Try a command like the following now:

mysql --user=root --password=something -D nameOfDB -h serverName -e "SELECT * FROM A_TABLE"

Simple BlogCFC Blog Roll pod for MySQL

I was looking for a BlogCFC Blog Roll pod today and could not find one that suited my needs, so here is the one I built for my MySQL db (note the MySQL script can easily be converted for MSSQL or other db types).

This is the Blog Roll MySQL CREAT TABLE script:

-- -----------------------------------------------------
-- Table `tblblogpod_blogroll`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `tblblogpod_blogroll` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`href` VARCHAR(255) NOT NULL DEFAULT 'http://' ,
`title` VARCHAR(255) NOT NULL ,
`text` VARCHAR(255) NOT NULL ,
`rel` VARCHAR(45) NOT NULL DEFAULT 'external nofollow' ,
`target` VARCHAR(15) NOT NULL DEFAULT '_blank' ,
PRIMARY KEY (`id`) )
ENGINE = MyISAM;

This is the Blog Roll Pod Code:

<cfsetting enablecfoutputonly='true'>
<cfprocessingdirective pageencoding='utf-8'>
<!---
Name : Blogroll for BlogCFC & MySQL
Author : Erik Vergobbi Vold
--->

<cfquery name="getBlogRoll" datasource="#application.blog.getProperty('dsn')#" username="#application.blog.getProperty('username')#" password="#application.blog.getProperty('password')#">
SELECT text, href, title, rel, target
FROM tblblogpod_blogroll
ORDER BY text
</cfquery>


<cfmodule template="../../tags/podlayout.cfm" title="Blog Roll">

<cfloop query="getBlogRoll">

<cfoutput><a #iif( len(trim(title)) gt 0, de('title="'&title&'"'), de(''))# #iif( len(trim(target)) gt 0, de('target="'&target&'"'),de(''))# #iif( len(trim(rel)) gt 0, de('rel="'&rel&'"'), de('
'))# href="#href#">#text#</a><br /></cfoutput>
</cfloop>

</cfmodule>

<cfsetting enablecfoutputonly='false'/>

If anyone else decides to use this for MSSQL, or some other db type, please post the SQL script in a comment, thank you.

© Erik Vold 2007-2010. Contact Erik Vold. Top ^