вівторок, 15 вересня 2009 р.

Sphinx example for PHP

Here is a great example for Sphinx written in PHP : http://www.sphinxsearch.com/wiki/doku.php?id=php_example_script

Have fun.

Resetting forgotten root password

if you forgot the root password - here is the recipe to reset it:

1) kill mysqld
2) run

mysqld_safe –skip-grant-tables &

mysql -u root mysql

mysql> UPDATE user SET Password=PASSWORD(’newrootpassword’) WHERE User=’root’;
mysql> FLUSH PRIVILEGES;

3) kill the started MySQL server
4) restart it

Resetting forgotten root password

if you forgot the root password - here is the recipe to reset it:

1) kill mysqld
2) run

mysqld_safe –skip-grant-tables &

mysql -u root mysql

mysql> UPDATE user SET Password=PASSWORD(’newrootpassword’) WHERE User=’root’;
mysql> FLUSH PRIVILEGES;

3) kill the started MySQL server
4) restart it

понеділок, 14 вересня 2009 р.

Example of MSSQL quiet installation

It installs only MSSQL engine. Other possible features can be: SSMS, ADV_SSMS, BOL...

Setup.exe /QUIET
/INDICATEPROGRESS
/Action=Install
/FEATURES=SQLENGINE
/INSTANCENAME="EVAL33"
/SQLSYSADMINACCOUNTS="BUILTIN\Administrators"
/SECURITYMODE=SQL /TCPENABLED="1"
/NPENABLED="1"
/ADDCURRENTUSERASSQLADMIN="True"
/SQLSVCSTARTUPTYPE="Automatic"
/SQLSVCACCOUNT="NT AUTHORITY\LOCAL SERVICE"
/SAPWD="xxxxx"

неділя, 30 серпня 2009 р.

Auto-increment field

How to create it in

a) MySQL:

CREATE TABLE `t1` ( `id` INT UNSIGNED AUTO_INCREMENT , ... ) AUTO_INCREMENT=... ;

b) PostgreSQL:
first create the sequence:

CREATE SEQUENCE "seq1" INCREMENT BY ... START WITH ... ;

and then - create the table:

CREATE TABLE "t1" ( "id" INT NOT NULL DEFAULT nextval('seq1') ...);

c) Microsoft SQL Server

CREATE TABLE [t1] ( [id] [int] NOT NULL identity(1, 2) ...);

(this means start with 1 and increment by 2 each time )

Paint & SQL Server. How to export diagram to image.

I think many people wondered why Paint application still exists in Windows? It has too few features. It is completely basic (or boring!).

But this tool can greatly help you with database design.

Say, you have the database diagram built in MSSQL Management Studio but you have no idea how to export it into the image.

Just PAINT !!!

Select all of the tables in the diagram, press Ctrl+C (or copy in your usual way) and paste it into Paint.

Do you like it?

понеділок, 3 серпня 2009 р.

Ukrainian, Russian and English character sets for Sphinx fulltext search

If you need all of those language for fulltext search the charset_table string should be the following:

charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F, U+404->U+454, U+406->U+456, U+407->U+457, U+490->U+491