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.
- Login as the root/admin of your database (you will be asked for password)
mysql -u root -p
- Create user ‘ezpdo_ex’
GRANT USAGE ON * . * TO "ezpdo_ex"@"localhost" IDENTIFIED \\ BY "pdoiseasy";
- Create database ‘ezpdo_ex’
CREATE DATABASE `ezpdo_ex`;
- 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