Configuring phpMyAdmin

Posted on October 17, 2008
Filed Under PHP, SQL | Leave a Comment

Installing phpMyAdmin is simple as extracting to the www folder, but I install it in a different way, I extract phpMyAdmin in Program Files folder, and configure Apache to map /myadmin to the extracted folder, and make that only accessible by the local machine for security purpose.

1
2
3
4
5
6
7
8
9
Alias /myadmin/ "C:/Program Files/phpMyAdmin-2.11.9.2/"
 
<Directory "C:/Program Files/phpMyAdmin-3.0.0">
    Options Indexes MultiViews
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
</Directory>

In the phpMyAdmin copy the config.sample.inc.php to config.inc.php and change the first server configuration to authenticate via configuration file so that I don’t have to enter the user name and password again and again and hide the mysql database as I don’t really need access to that.

1
2
3
4
5
6
7
8
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['user'] = "root";
$cfg['Servers'][$i]['password'] = "xxxxxx";
$cfg['Servers'][$i]['hide_db']  = "mysql";
$cfg['Servers'][$i]['extension'] = 'mysql';

Change the Server Collation of SQL Server 2005

Posted on October 11, 2008
Filed Under SQL | 2 Comments

I installed my SQL Server 2005 wit the default options and found out that my db collation and the server collation were different that caused my application to throw a collation mismatch exception when comparing.

I tried my options, but couldn’t get it working with out changing the server collation to be the same as the database collection option. I still believe that there should be a way to do it with out doing so, but I don’t have much time to put in to find out how.

Changing the Server Collation is bit tricky, basically we will have to reinstall the SQL server instance, with the new Server Collation, you can do it with the setup.exe in the “C:\Program Files\Microsoft SQL Server\90\Setup Bootstrap” folder.

1
2
3
4
5
6
start /wait setup.exe /qb 
	INSTANCENAME=MSSQLSERVER 
	REINSTALL=SQL_Engine 
	REBUILDDATABASE=1 
	SAPWD=test 
	SQLCOLLATION=Finnish_Swedish_CS_AS

Warning: When you reinstall the SQL Engine, you will loose all your user databases so please take a back up of all your user databases before you do this.

Select a random row from a table

Posted on December 22, 2007
Filed Under SQL | Leave a Comment

I was looking for a clean and simple way of selecting a random record from a table. Here is what I found…

1
SELECT * FROM TABLE ORDER BY RAND() LIMIT 1
  • About

    This is an area on your website where you can add text. This will serve as an informative location on your website, where you can talk about your site.