Phpmyadmin

De WikiLICC
Revisão de 01h44min de 13 de setembro de 2015 por Dago (Discussão | contribs) (Setting the permissions for the pma account)
Ir para: navegação, pesquisa

Para habilitar designer no phpmyadmin siga:

Importing the phpmyadmin database

  • Launch phpMyAdmin, make sure the home screen is selected, and click the Import tab.
  • Click the Browse and select /usr/share/phpMyAdmin/sql/create_tables.sql.

Creating the pma user account

phpMyAdmin requires a dedicated user account for the phpmyadmin database.

  • Click the Users tab
  • Click Add user.
  • Use
 User name: pma
 Host: localhost
 Password: secret (choose your own password)
  • Click Go to create the user account.

Setting the permissions for the pma account

  • Click the SQL tab at the top of the phpMyAdmin screen.
  • Copy the following series of SQL queries, and paste them into the SQL field in phpMyAdmin.
   GRANT USAGE ON mysql.* TO 'pma'@'localhost';
   GRANT SELECT (
   Host, User, Select_priv, Insert_priv, Update_priv, Delete_priv,
   Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv,
   File_priv, Grant_priv, References_priv, Index_priv, Alter_priv,
   Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv,
   Execute_priv, Repl_slave_priv, Repl_client_priv
   ) ON mysql.user TO 'pma'@'localhost';
   GRANT SELECT ON mysql.db TO 'pma'@'localhost';
   GRANT SELECT ON mysql.host TO 'pma'@'localhost';
   GRANT SELECT (Host, Db, User, Table_name, Table_priv, Column_priv)
   ON mysql.tables_priv TO 'pma'@'localhost';
   GRANT SELECT, INSERT, UPDATE, DELETE ON phpmyadmin.* TO 'pma'@'localhost';
  • Click Go to execute the queries.

Update the phpMyAdmin configuration file

Before the advanced features can be used, you need to add the details of the pma user and the phpmyadmin database to the phpMyAdmin configuration file, config.inc.php.

  • You can either edit the existing version of config.inc.php, which is in the main phpmyadmin folder (/Applications/MAMP/bin/phpMyAdmin), or copy the following script, and use it to replace config.inc.php.
   <?php
   /*
    * This is needed for cookie based authentication to encrypt password in
    * cookie
    */
   $cfg['blowfish_secret'] = 'a8b7c6d'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
   /*
    * Servers configuration
    */
   $i = 0;
   /*
    * First server
    */
   $i++;
   /* Authentication type */
   $cfg['Servers'][$i]['auth_type'] = 'config';
   $cfg['Servers'][$i]['user'] = 'root';
   $cfg['Servers'][$i]['password'] = 'root';
   /* Server parameters */
   $cfg['Servers'][$i]['host'] = 'localhost';
   $cfg['Servers'][$i]['connect_type'] = 'tcp';
   $cfg['Servers'][$i]['compress'] = false;
   /* Select mysql if your server does not have mysqli */
   $cfg['Servers'][$i]['extension'] = 'mysqli';
   $cfg['Servers'][$i]['AllowNoPassword'] = false;
   /*
    * phpMyAdmin configuration storage settings.
    */
   /* User account for configuration storage */
   $cfg['Servers'][$i]['controluser'] = 'pma';
   $cfg['Servers'][$i]['controlpass'] = 'secret';
   /* Storage database and tables */
   $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
   $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
   $cfg['Servers'][$i]['relation'] = 'pma__relation';
   $cfg['Servers'][$i]['table_info'] = 'pma__table_info';
   $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
   $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
   $cfg['Servers'][$i]['column_info'] = 'pma__column_info';
   $cfg['Servers'][$i]['history'] = 'pma__history';
   $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
   $cfg['Servers'][$i]['tracking'] = 'pma__tracking';
   $cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';
   $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
   $cfg['Servers'][$i]['recent'] = 'pma__recent';
   $cfg['Servers'][$i]['users'] = 'pma__users';
   $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
   $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
   /*
    * End of servers configuration
    */


   ?>

The preceding script uses the MAMP default root password for MySQL (root):

   $cfg['Servers'][$i]['password'] = 'root';

It also uses secret as the password for the pma user account:

   $cfg['Servers'][$i]['controlpass'] = 'secret'; 

Change both values as appropriate.

  • If you decide to edit the existing version of config.inc.php, you need to set the values for phpMyAdmin configuration storage settings as shown in the last two sections of the preceding script.
  • If you're using MAMP Pro, you also need to make a copy of the updated config.inc.php, and use it to replace the version of config.inc.php located at /Library/Application Support/appsolute/MAMP PRO/phpmyadmin.

Reload the configuration

Before the changes take effect, you need to reload the MySQL privileges and the phpMyAdmin configuration. The simple way to do this is to stop MySQL and restart the server. Then close your browser, and relaunch phpMyAdmin. You should now have access to the advanced features of phpMyAdmin.