pma.sh 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/bin/bash
  2. #
  3. # phpmyadmin-fixer
  4. #
  5. # Fixes for phpmyadmin (configuration storage and some extended features)
  6. #
  7. # Original Version by Pavel Galkin (https://skurudo.ru)
  8. # https://github.com/skurudo/phpmyadmin-fixer
  9. #
  10. # Changed some lines to fit to Hestia Configuration.
  11. #
  12. PASS=$(gen_pass)
  13. #ubuntu phpmyadmin path
  14. pmapath1="/etc/phpmyadmin/conf.d/01-localhost.php"
  15. echo "\$cfg['Servers'][\$i]['favorite'] = 'pma__favorite';" >> $pmapath1
  16. echo "\$cfg['Servers'][\$i]['usergroups'] = 'pma__usergroups';" >> $pmapath1
  17. echo "\$cfg['Servers'][\$i]['central_columns'] = 'pma__central_columns';" >> $pmapath1
  18. echo "\$cfg['Servers'][\$i]['designer_settings'] = 'pma__designer_settings';" >> $pmapath1
  19. echo "\$cfg['Servers'][\$i]['export_templates'] = 'pma__export_templates';" >> $pmapath1
  20. echo "\$cfg['Servers'][\$i]['savedsearches'] = 'pma__savedsearches';" >> $pmapath1
  21. echo "\$cfg['Servers'][\$i]['navigationhiding'] = 'pma__navigationhiding';" >> $pmapath1
  22. echo "\$cfg['Servers'][\$i]['users'] = 'pma__users';" >> $pmapath1
  23. echo "\$cfg['Servers'][\$i]['usergroups'] = 'pma__usergroups';" >> $pmapath1
  24. echo "\$cfg['Servers'][\$i]['pmadb'] = 'phpmyadmin';" >> $pmapath1
  25. echo "\$cfg['Servers'][\$i]['controluser'] = 'pma';" >> $pmapath1
  26. echo "\$cfg['Servers'][\$i]['controlpass'] = '$PASS';" >> $pmapath1
  27. echo "\$cfg['Servers'][\$i]['bookmarktable'] = 'pma__bookmark';" >> $pmapath1
  28. echo "\$cfg['Servers'][\$i]['relation'] = 'pma__relation';" >> $pmapath1
  29. echo "\$cfg['Servers'][\$i]['userconfig'] = 'pma__userconfig';" >> $pmapath1
  30. echo "\$cfg['Servers'][\$i]['table_info'] = 'pma__table_info';" >> $pmapath1
  31. echo "\$cfg['Servers'][\$i]['column_info'] = 'pma__column_info';" >> $pmapath1
  32. echo "\$cfg['Servers'][\$i]['history'] = 'pma__history';" >> $pmapath1
  33. echo "\$cfg['Servers'][\$i]['recent'] = 'pma__recent';" >> $pmapath1
  34. echo "\$cfg['Servers'][\$i]['table_uiprefs'] = 'pma__table_uiprefs';" >> $pmapath1
  35. echo "\$cfg['Servers'][\$i]['tracking'] = 'pma__tracking';" >> $pmapath1
  36. echo "\$cfg['Servers'][\$i]['table_coords'] = 'pma__table_coords';" >> $pmapath1
  37. echo "\$cfg['Servers'][\$i]['pdf_pages'] = 'pma__pdf_pages';" >> $pmapath1
  38. echo "\$cfg['Servers'][\$i]['designer_coords'] = 'pma__designer_coords';" >> $pmapath1
  39. #SOME WORK with DATABASE (table / user)
  40. PMADB=phpmyadmin
  41. PMAUSER=pma
  42. #DROP USER and TABLE
  43. # mysql -uroot <<MYSQL_PMA1
  44. # DROP USER '$PMAUSER'@'localhost';
  45. # DROP DATABASE $PMADB;
  46. # FLUSH PRIVILEGES;
  47. # MYSQL_PMA1
  48. #CREATE PMA USER
  49. mysql -uroot <<MYSQL_PMA2
  50. CREATE USER '$PMAUSER'@'localhost' IDENTIFIED BY '$PASS';
  51. CREATE DATABASE $PMADB;
  52. MYSQL_PMA2
  53. #GRANT PMA USE SOME RIGHTS
  54. mysql -uroot <<MYSQL_PMA3
  55. USE $PMADB;
  56. GRANT USAGE ON $PMADB.* TO '$PMAUSER'@'localhost' IDENTIFIED BY '$PASS';
  57. GRANT ALL PRIVILEGES ON $PMADB.* TO '$PMAUSER'@'localhost';
  58. FLUSH PRIVILEGES;
  59. MYSQL_PMA3
  60. #MYSQL DB and TABLES ADDITION
  61. mysql -uroot < $HESTIA_INSTALL_DIR/phpmyadmin/create_tables.sql