Hi,
I found some tutorial how to create a new database on Firebird :
ZConnection1.Database := 'd:\db1.fdb';
ZConnection1.Protocol := 'firebird-1.5';
ZConnection1.Properties.Add ('CreateNewDatabase=CREATE DATABASE ' +
QuotedStr ('d:\db1.fdb') + ' USER ' +
QuotedStr ('sysdba') + ' PASSWORD ' + QuotedStr ('masterkey') +
' PAGE_SIZE 4096 DEFAULT CHARACTER SET ISO8859_1');
ZConnection1.Connect;
Does similar way is valid for MySQL as well. Especially I mean a row with command ZConnection1.Properties.Add( ....) ?
Any help how to create a new database on MySQL server a connect to it is appreciated.
Thanks.
Marian
Creation of a new database
Moderators: gto, cipto_kh, EgonHugeist
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Just connect to the server using a user which has sufficient rights to create a database. It's easiest if you can connect to a database that already exists (eg. database mysql when connected as root), but using the property 'dbless=true' that's not necessary.
Once connected you can fire a normal query : 'create database <dbname>;' that's it.
To fire this query : put a TZQuery component in your form. set SQL.text property to the query string and call execSQL method.
When using Testing branch/snapshot it's even easier : use TZConnection.ExecuteDirect(SQL:string):boolean
Mark
Once connected you can fire a normal query : 'create database <dbname>;' that's it.
To fire this query : put a TZQuery component in your form. set SQL.text property to the query string and call execSQL method.
When using Testing branch/snapshot it's even easier : use TZConnection.ExecuteDirect(SQL:string):boolean
Mark