Posts Tagged ‘mysql’

Purge OpenX statistics tables

OpenX is a great tool for displaying ads on your website. But there is a small issue I’ve been wanting to address: statistics data. OpenX gathers a lot of data about clicks and impressions of your banners. While this can be very helpful, it also puts a strain on the database. And as I use [...]

More »

Connect PowerShell to MySQL

Using the MySQL.NET connector, it’s possible to connect to a MySQL database using PowerShell. /* replace path with your local /path/to/mysql/connector/MySQL.Data.dll */ [void][system.reflection.Assembly]::LoadFrom(\"d:\\tools\\mysql-connector\\bin\\MySQL.Data.dll\") $myconnection = New-Object MySql.Data.MySqlClient.MySqlConnection $myconnection.ConnectionString = \"server=localhost;user id=test;password=test;database=test;pooling=false\" $myconnection.Open() $mycommand = New-Object MySql.Data.MySqlClient.MySqlCommand $mycommand.Connection = $myconnection $mycommand.CommandText = "SHOW TABLES" $myreader = $mycommand.ExecuteReader() while($myreader.Read()){ $myreader.GetString(0) } This example will display all tables [...]

More »