1

I have installed MAMP. It works fine from localhost:8888 and I can access phpmyadmin from localhost:8888/MAMP. In my application I am using zend framework 2. I am running basic Album module on my local host. But some how it's not running on local server. When I checked database in MAMP. There was nothing in there.

Where do I need to locate MAMP phpmyadmin access credentials in zend code?

4

1 回答 1

1

只是想知道您是否将 phpMyAdmin 与 MySQL 混淆了?

phpMyAdmin 只是一个基于 Web 的 MySQL 界面。如果数据库在 phpMyAdmin 中不可见,则可能没有创建。您可以在 phpMyAdmin 中或在 MySQL 提示符下创建数据库。

创建数据库后,再查看教程http://framework.zend.com/manual/2.0/en/user-guide/database-and-models.html中的此页面,它具有您可以运行的 sql 脚本phpMyAdmin 或 MySQL 提示符来创建表。

创建数据库和表后编辑

config/autoload/global.php

config/autoload/local.php

(上面的教程链接中再次包含说明)

顺便说一句,使用 MAMP 访问 MySQL 提示符,在您的终端中键入以下内容;

/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot

http://blog-en.mamp.info/2009/08/using-mysql-command-line-with-mamp.html

运行此 SQL 以创建和填充您的表

CREATE TABLE album (
  id int(11) NOT NULL auto_increment,
  artist varchar(100) NOT NULL,
  title varchar(100) NOT NULL,
  PRIMARY KEY (id)
);
INSERT INTO album (artist, title)
    VALUES  ('The  Military  Wives',  'In  My  Dreams');
INSERT INTO album (artist, title)
    VALUES  ('Adele',  '21');
INSERT INTO album (artist, title)
    VALUES  ('Bruce  Springsteen',  'Wrecking Ball (Deluxe)');
INSERT INTO album (artist, title)
    VALUES  ('Lana  Del  Rey',  'Born  To  Die');
INSERT INTO album (artist, title)
    VALUES  ('Gotye',  'Making  Mirrors');
于 2013-08-22T19:39:53.197 回答