Joomla!: phpMyAdmin for Beginners

3,409 views

Published on

Presentation on phpMyAdmin for Joomla! beginners

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,409
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
57
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Joomla!: phpMyAdmin for Beginners

  1. 1. phpMyAdmin for beginners Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  2. 2. I am Jisse Reitsma Developer Enterpreneur Founder of Yireo Joomla! & Magento Extensions & development Documentation & blogs Joomla! templates-book (NL) Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  3. 3. You are a ... Joomla! site-owner? Joomla! builder? Joomla! developer? Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  4. 4. My presentation Part I - MySQL Part II - phpMyAdmin Part III - Advanced Presentation online: http://slideshare.net/yireo Tweets: @yireo Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  5. 5. Part 1: MySQL Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  6. 6. Introduction to MySQL Part of a stack Client/server architecture What is SQL? Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  7. 7. Stack Joomla! is based on PHP, which runs on a webserver with PHPsupport (like Apache), and data are stored in MySQL. Examples of webserver “stacks” Linux + Apache + Mysql + PHP = LAMP MacOS + Apache + Mysql + PHP = MAMP Windows + Apache + Mysql + PHP = WAMP Windows + IIS + Mysql + PHP = WIMP Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  8. 8. Introduction to MySQL Part of a stack Client/server architecture What is SQL? Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  9. 9. MySQL server MySQL on the same server as the website localhost On a different server but with the same hoster mysql12345.hoster.local On a different server with a different hoster TCP-port 3306 opened in firewall Security becomes a major issue Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  10. 10. MySQL client PHP library (“mysql”, “mysqli”, “PDO Mysql”) Joomla! (PHP “mysqli”) phpMyAdmin (PHP “mysqli”) command-line client (SSH) MySQL GUI client (Navicat, SQLWave, HeidiSQL) Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  11. 11. Introduction to MySQL Part of a stack Client/server architecture What is SQL? Structured Query Language A way to talk with a relational database Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  12. 12. Structured Query Language A common language to talk with different databases: SELECT field FROM table DELETE FROM table WHERE id = 2 INSERT INTO table SET id = 2, value = “example” ... but unfortunately there are still a lot of different SQL dialects Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  13. 13. SQL databases MySQL SQLite MariaDB Sybase Oracle Microsoft SQL DB2 Microsoft Access dBase PostgreSQL Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  14. 14. Relational database Store data in multiple database-tabels that relate to each other Normalisation “Technique, used in the process of designing a database-structure, with the purpose to avoid storing the same data multiple times” Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  15. 15. Example 1: Joomla! users jos_users List of users jos_usergroups List of usergroups jos_user_usergroup_map Connection between users and usergroups Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  16. 16. Example 2: Joomla! articles jos_content List of articles (with a reference to catid & asset_id) jos_categories List of categories jos_assets List of authorizations Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  17. 17. Part 2: phpMyAdmin Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  18. 18. phpMyAdmin Overview of phpMyAdmin SELECT-statement Common tasks (edit, add, delete) Import & export Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  19. 19. Login to phpMyAdmin Direct weblink Control panel CPanel, Plesk, DirectAdmin custom panel Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  20. 20. Creating a database Create an user with corresponding database Check upon the character collation utf8_unicode_ci / utf8_general_ci Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  21. 21. phpMyAdmin Overview of phpMyAdmin SELECT-statement Common tasks (edit, add, delete) Import & export Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  22. 22. Opening a database-table Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  23. 23. SELECT (1/3) SELECT * FROM jos_users; SELECT title,alias FROM jos_content; SELECT id,username FROM jos_users; SELECT name,type,enabled FROM jos_extensions; Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  24. 24. SELECT (2/3) Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  25. 25. SELECT (3/3) Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  26. 26. WHERE SELECT * FROM x WHERE id = 42; SELECT * FROM x WHERE id IN (42,43,44,45); SELECT * FROM x WHERE title = “Example 1”; SELECT * FROM x WHERE title LIKE “Example%”; SELECT * FROM x WHERE title LIKE “%example%”; SELECT * FROM x WHERE created_time > “2012­02”; Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  27. 27. Quotes (1/2) Fout: SELECT from FROM select WHERE where LIKE “a%”; Correct: SELECT `from` FROM `select` WHERE `where` LIKE “a%”; Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  28. 28. Quotes (2/2) SELECT `id`,`title`,`description` FROM `jos_content`  WHERE `title` LIKE “example%” AND `id` IN  (25,26,27,28,29,30) AND `created_time` > “”; Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  29. 29. phpMyAdmin Overview of phpMyAdmin SELECT-statement Common tasks (edit, add, delete) Import & export Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  30. 30. Update, insert, delete UPDATE jos_content  SET `title`=”Hello World” WHERE `title`=”Hello world”; INSERT INTO jos_content  VALUES `title`=”x”; DELETE FROM jos_content WHERE `id`=2; Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  31. 31. phpMyAdmin Overview of phpMyAdmin SELECT-statement Common tasks (edit, add, delete) Import & export Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  32. 32. Export Which database tables? Single database-table? Multiple database-table? All database-tables? (so: the entire database) Which data? Table-structure and/or table-data ... or use “Akeeba Backup” (akeebabackup.com) Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  33. 33. Part 3: Advanced Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  34. 34. Database table prefix Database table prefix Adjustable during Joomla! installation Make hacks more difficult (SQL-injection) Recommendations Do not choose “jos_” Do not choose “verylongstring_”. MySQL limits table-name to 64 characters Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  35. 35. User ID 42 Default “admin” user had ID 42 (Joomla! 2.5 and older) Make hacks easier (SQL-injection) Procedure to adjust Create a new Super User and login as that user Degrade the old Super User to administrator Remove that administrator Update current Super User with old settings ... or use “Akeeba AdminTools” (akeebabackup.com) Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  36. 36. Cleanup of database-tables TRUNCATE `jos_content`; Be very careful with this Make sure to have a backup Make manual checks with other tables Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  37. 37. JOINs LEFT JOIN RIGHT JOIN INNER JOIN OUTER JOIN Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  38. 38. Example JOIN SELECT article.*, cat.title AS cat_title  FROM jos_content AS article LEFT JOIN  jos_categories AS cat ON cat.id = a.catid WHERE cat.id = 3; Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  39. 39. UTF-8 & collations UTF-8 = Default character set for Joomla! Support for Western languages, Arab, Sanskrit, Klingon Collations = Interpretation of characterset for storage utf8_general_ci (standard) utf8_unicode_ci (recommended) utf8_polish_ci latin1 (do not use) Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  40. 40. Wrong collation If a Joomla! database does not use UTF-8, make sure it does (for every database, table and field) Set Joomla! site offline Export the datase to a SQL-file Change all occurances of “charset=latin1 “ to “charset=utf8” Import the SQL-file ... or use “Phoca Changing Collation Tool” (phoca.cz) Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  41. 41. MyISAM & InnoDB MyISAM Storage Engine Default in most hosting environments InnoDB Storage Engine More advanced; More tuning options But not necessary for running Joomla! Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  42. 42. Alternatives to MySQL Percona MariaDb NoSQL (Redis) Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  43. 43. Database optimizations Make sure to have enough RAM (memory) Variables query_cache_size table_cache, table_size Vari ous buffers InnoDB stuff (pool size, threading) Adjust & monitor; Adjust & monitor Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  44. 44. My presentation Part I - MySQL Stack; Client/server; SQL Part II - phpMyAdmin INSERT, SELECT, UPDATE, DELETE; Create a database, database-user; Import / export; Part III - Advanced JOINs; UTF-8, collations; user-ID 42; MyISAM, InnoDB TRUNCATE; database table prefix; tuning Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo
  45. 45. tweet @yireo Presentation “phpMyAdmin for beginners” - http://slideshare.net/yireo Jisse Reitsma (jisse@yireo.com) - Twitter @yireo

×