Database setup

For the tutorial example to run, you need to setup a database to store the objects to be created.

If you want to use the default DSN’s specified in the config file (config.xml), you need to create a database user ‘ezpdo_ex’ (with password ‘pdoiseasy’) and database ‘ezpdo_ex’. Make sure the database is accessible by the user ‘ezpdo_ex’ with all permission granted.

Assuming we are using MySQL. The setup can be easily done if you use phpMyAdmin. Or if you prefer command line, do the following as the database root.

  1. Login as the root/admin of your database (you will be asked for password)

    mysql -u root -p

  2. Create user ‘ezpdo_ex’

    GRANT USAGE ON * . * TO "ezpdo_ex"@"localhost" IDENTIFIED \\
      BY "pdoiseasy";

  3. Create database ‘ezpdo_ex’

    CREATE DATABASE `ezpdo_ex`;

  4. Grant all privileges on database ‘ezpdo_ex’ to user ‘ezpdo_ex’

    GRANT ALL PRIVILEGES ON `ezpdo_ex` . * TO "ezpdo_ex"@"localhost";

Customization

In case you want to use different names/password of user and database, you need to modify <default_dsn> in the config file (config.xml) and the @orm tags in the class files. For example, if you want to use

mysql://MY_ezpdo_ex:pdoisVERYeasy@localhost/MY_ezpdo_ex

instead, then in config.xml replace

<default_dsn>mysql://ezpdo_ex:pdoiseasy@localhost/ezpdo_ex</default_dsn>

with

<default_dsn>mysql://MY_ezpdo_ex:pdoisVERYeasy@localhost/MY_ezpdo_ex</default_dsn>

and in all class files in sub-directory classes replace

* @orm mysql://ezpdo_ex:pdoisiseasy@localhost/ezpdo_ex

with

* @orm mysql://MY_ezpdo_ex:pdoisVERYeasy@localhost/MY_ezpdo_ex

6 user comments

  1. xfacftorx on August 1st, 2005:

    I tried following the simple example and I get this error:

    Fatal error: Call to undefined function: mysql_connect()
    in c:\…\libs\adodb\drivers\adodb-mysql.inc.php on line 338

    Am suspecting it has to with mysql seetings: here is what I have in the config file:

    mysql://root:@localhost/ezpdo
    mysql://root:""@localhost/ezpdo
    -->

  2. ezpdo4php on August 1st, 2005:

    if no password, simply mysql://root@localhost/ezpdo. no ‘:’ after username. (a side note: not having a password to secure your database may increase security risk.)

  3. Daniel on August 2nd, 2005:

    Fatal error: Call to undefined function: mysql_connect()
    in c:\…\libs\adodb\drivers\adodb-mysql.inc.php on line 338

    Looks like your MySQL extension is not enabled on your php installation. Check php.ini and uncomment the line
    extension=php_mysql.dll (or .so if you’re on Linux)

  4. purplehaze on October 5th, 2005:

    I have had the same error in book example if I ommit $m->flush() .
    auto_flush option in config.xml is on.
    With $m->flush() I got no errors.

  5. ezpdo4php on October 5th, 2005:

    Could you please report the problem in the bug tracking system with your OS and PHP info? We’d want to keep track of this problem. Thank you.

  6. Aaron on August 2nd, 2006:

    I need help using php i need help w/ the $get

Post your comments

XHTML: tags you can use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Couldn't find your convert utility. Check that you have ImageMagick installed.