If you want to use phpMyAdmin to set up relations, you have to do 2 things. First of all, you have to define an index on the foreign key column in the referring table (so foo_bar.foo_id, in your case). Then, go to relation view (in the referring table) and select the referred column (so in your case foo.id) and the on update and on delete actions.
I think foreign keys are useful if you have multiple tables linked to one another, in particular, your delete scripts will become very short if you set the referencing options correctly.
EDIT: Make sure both of the tables have the InnoDB engine selected.
Related Posts:
- #1045 – Access denied for user ‘root’@’localhost’ (using password: YES)
- MySQL Error #1133 – Can’t find any matching row in the user table
- phpmyadmin #1045 Cannot log in to the MySQL server. after installing mysql command line client
- How to create a foreign key in phpmyadmin
- importing a CSV into phpmyadmin
- MySQL said: Documentation #1045 – Access denied for user ‘root’@’localhost’ (using password: NO)
- What specific database privileges does WordPress need?
- “#1067 – Invalid default value for ‘post_date'” when trying to reset AI after backup
- How to copy post titles to post slug in phpmyadmin
- How to do a MySQL dump from production site without using a search and replace script for local development?
- How to Create a Admin User for A WordPress Site via MySQL (PHPMyAdmin)?
- SQL error #1062 – Duplicate entry ‘1’ for key ‘PRIMARY’ [closed]
- Set meta_key and meta_value for all registered user in wordpress using sql query [closed]
- Can’t find my wordpress DB in phpmyadmin
- Backing up and restoring multiple sites efficiently
- $wpdb to insert html form information
- Setting up WordPress Locally on WAMP for a new site (with one already)
- Getting Error Trying to Create Table
- Export Yoast Keywords from MySQL/phpMyAdmin
- Editing mysql tables/database with wordpress or other app/cms
- List users with the most posts in the last 30 days
- Export SQL query based on custom field?
- Mysql Server keeps crashing
- How to bulk delete a certain part of all wordpress posts
- When I add metadata, metavalue length is added in to the value in some cases
- WordPress fails to install with “Can’t Select Database” Error (WAMPServer)
- Find locations of all featured images of draft posts via SQL
- SQL query to change custom field in WordPress database
- An SQL query to find orphaned image attachments and their meta
- cannot log in to the mysql server (wamp and wordpress)
- SQL command to export post_content from wp_posts using phpMyAdmin
- Need SQL query to find&replace image URL
- MySQL Error: : ‘Access denied for user ‘root’@’localhost’
- ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
- Can’t connect to local MySQL server through socket ‘/var/mysql/mysql.sock’ (38)
- ERROR 1698 (28000): Access denied for user ‘root’@’localhost’
- When to use SELECT … FOR UPDATE?
- Create a new database with MySQL Workbench
- Column ‘user_id’ in field list is ambiguous
- Database sharding vs partitioning
- 1052: Column ‘id’ in field list is ambiguous
- Escape string Python for MySQL
- 1052: Column ‘id’ in field list is ambiguous
- how to overcome ERROR 1045 (28000): Access denied for user ‘ODBC’@’localhost’ (using password: NO) permanently
- SQL ZOO List each continent and the name of the country that comes first alphabetically
- Fatal error: Please read “Security” section of the manual to find out how to run mysqld as root
- ERROR 1044 (42000): Access denied for user ”@’localhost’ to database ‘db’
- How to install Python MySQLdb module using pip?
- Access denied for user ‘root’@’localhost’ (using password: YES) after new installation on Ubuntu
- Dump all tables in CSV format using ‘mysqldump’
- How to do a batch insert in MySQL
- If variable equals value php [duplicate]
- MySQL: Cloning a MySQL database on the same MySql instance
- mysqldump data only
- PHP date() format when inserting into datetime in MySQL
- WordPress mysqli and PDO
- Same option_id=0 for 2 options in wp_options?
- How to let a user choose an authors and save it to the database?
- How to remove ‘GROUP BY’ from SQL query produced from get_posts?
- MySQL LIKE not working
- Is a MySQL DATETIME or TIMESTAMP value retrieved through $wpdb in UTC?
- Emojis getting converted to “?”
- Join new table with SQL query
- MySQL crashed because of the large number of requests
- Why doesn’t this code add a table to my database?
- SQL database export-import
- Can Someone Help Me Fix This WordPress Missing Argument Error?
- How do I get create a custom table showing the hours remaining for all customers in one page from this transactions page?
- Uncaught Error: Call to undefined function mysql_connect() – WordPress installation
- SQL Database, repeated tables?
- Visual/Text Editor displays blank pages in WP-Admin- but HTML on client side displays correctly
- Code to remove authors with no posts connected to them
- SQL Query in WordPress – Getting Impossible WHERE error
- Can’t update WordFence Options, clear data manually
- WordPress create database not working
- database optimization and server errors
- Calling mysql_query() on another database, assumes WordPress using that database
- WordPress VIP realpath Alternative?
- querying user bookmarks from a large number of bookmarks
- Pull post name from value of a specific meta key
- PHP variables in mysql query
- How to fix the amount of comments displayed for each post?
- How do I echo all users’ display_name and their meta_value who have a certain meta_key?
- How to simulate web traffic to test performance of a website
- SQL. Select category descendants
- MySQL Actibity without any active visitors via Google Analytics
- How to configure WordPress Database for CentOS 7
- Why is local wordpress install calling live site executions?
- Display MySQL as part of a Page
- Migration of wordpress database from mariadb 10.0.20 to 5.5.50
- WP Meta Query – mixed AND / OR query doesn’t work
- Second completely independent and disposable WordPress installation in subdirectory?
- get_results suddenly not working on a single table
- Internal error (500) on local & Fatal error on live when trying to access post type edit screen
- Query sql for truncate post_content in wp_posts table
- Foreach only outputs if id is 0
- “Error 1064” when importing msql database after updating wordpress version to 4.2.1
- Why does the MySQL command line tool ignore the –port parameter?
- Postgres equivalent to MySQL’s \G?
- Possible SQL injection. How to locate and fix?