Following CakePHP Blog tutorial with PhpED: Configure MySQL
This section is following sections 3 and 4 of CakePHP Blog tutorial.
We will start by configuring Blog's MySQL database using PhpED's MySQL database connection client. Ben Horde pointed out to the nice way of starting XAMP in his Joomla tutorial, feel free to do the same to start and stop MySQL server on your computer. Then you can:
- Setup MySQL account as described in MySQL database connection client tutorial and open it
- Copy paste the following table creation code from CakePHP 15 minutes Blog Tutorial:
/* First, create our posts table: */
CREATE TABLE posts (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(50),
body TEXT,
created DATETIME DEFAULT NULL,
modified DATETIME DEFAULT NULL
);
/* Then insert some posts fortesting: */
INSERT INTO posts (title,body,created)
VALUES ('The title', 'This is the post body.', NOW());
INSERT INTO posts (title,body,created)
VALUES ('A title once again', 'And the post body follows.', NOW());
INSERT INTO posts (title,body,created) VALUES
('Title strikes back', 'This is really exciting! Not.', NOW());
into SQL window of the client and execute it: |
|
|
You will need to get back into MySQL database connection client later to create a new user 'cakeBlog' used in the tutorial - note that tutorial never mentions that! But that's Ok, we got you covered.
Section 4 of the tutorial continues Cake Database Configuration and explains how to edit database.php.default file. Edits are easily done using PhpED PHP Editor Tools, but the time has come to create a new user in the database. You can do it by running the following statement in the SQL tab of MySQL database connection client:
GRANT ALL PRIVILEGES ON *.* TO 'cakeBlog'@'localhost'
IDENTIFIED BY 'c4k3-rUl3Z' WITH GRANT OPTION;
Once it is done and you have edited database.php.default and changed its name to database.php, you can make sure that cake can connect to the database. Just open index.php file in PhpED and hit Run button. Here is what you should see, if your PhpED's PHP Viewer is configured to be embedded Mozilla/FireFox: |
|
|
|