Where can I find create_tables.sql for phpMyAdmin? - php

When logging into phpMyAdmin I receive the following warning:
The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated.
I am attempting phpMyAdmin's suggested remedy here: http://docs.phpmyadmin.net/en/latest/setup.html#manual-configuration
I tried finding create_tables.sql, like this...
find / -name 'create_tables.sql'
I even tried finding all .sql files, like this...
find / -iname '*.sql'
...but it wasn't one of the files found.
Is there somewhere I can download this file?

The links at the top of the documentation page were useless.
Go to http://www.phpmyadmin.net/home_page/downloads.php
Download one of the packages, and in the root you will find the ./sql/create_tables.sql file that the documentation was referencing.
It also turns out the create_tables.sql file that is downloadable from the link above is missing one of the tables pma__designer_coords
To add the missing table, run the following query:
CREATE TABLE IF NOT EXISTS `pma__designer_coords` (
`db_name` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`table_name` varchar(64) COLLATE utf8_bin NOT NULL DEFAULT '',
`x` int(11) DEFAULT NULL,
`y` int(11) DEFAULT NULL,
`v` tinyint(4) DEFAULT NULL,
`h` tinyint(4) DEFAULT NULL,
PRIMARY KEY (`db_name`,`table_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
Get it together phpMyAdmin.

Related

MySQL DB Migration fail

For a wordpress website I am trying to migrate the website and MySQL database. Although when I import it, it gives me an error. I no longer have access to the old one.
Error
SQL query:
CREATE TABLE `wp_commentmeta` (
`meta_id` bigint(20) UNSIGNED NOT NULL,
`comment_id` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
`meta_key` varchar(255) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL,
`meta_value` longtext COLLATE utf8mb4_unicode_520_ci
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci
MySQL said: Documentation
#1046 - No database selected
1046 - No database selected Should have been a bit of a clue. Add a USE DATABASE_NAME; at the top of this script. So that MYSQL knows which database you are trying to create the table in
– RiggsFolly

Build a Matrix style Grid of User Permission Setting with PHP and MySQL

I've been tasked with adding in a link/menu dashboard for my work. It needs to have user permissions to view/not view each link record on a per user basis.
Most time this is done with user groups, I need to do it per-user for per-link.
I have started by using a middle database table to join users and links as well as hold the user permission if they are allowed to view each link. I will show the Database design below.
What I need help with is build a table/grid to mass set permissions for each user on each menu link.
I would like to do it similar to this image below...
View full size image
So I need to pull in users from the database and the links from the database as well as the permission records.
Build a grid with users in the vertical column and links in the horizontal.
The permissions setting will then fill in the grid spaces and I think it would be best to have a simple Form Selection field for a yes/no value.
Admin can change permissions for each user and submit the form which will need to then update every Permission record!
Here is what my 3 demo database tables look like...
Links table
CREATE TABLE IF NOT EXISTS `links` (
`id` int(11) NOT NULL,
`parent` int(11) NOT NULL DEFAULT '0',
`sort` int(11) NOT NULL DEFAULT '0',
`text` char(32) COLLATE utf8_bin NOT NULL,
`link` text COLLATE utf8_bin NOT NULL,
`permission` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
User table
CREATE TABLE IF NOT EXISTS `user` (
`id` int(11) NOT NULL DEFAULT '0',
`name` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT 'user',
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
**Permission table: user_link_permissions **
CREATE TABLE IF NOT EXISTS `user_link_permissions` (
`id` int(100) NOT NULL,
`user_id` int(30) NOT NULL,
`link_id` int(30) NOT NULL,
`permission` int(2) NOT NULL DEFAULT '0'
) ENGINE=InnoDB AUTO_INCREMENT=41 DEFAULT CHARSET=latin1;
Where I need some help...
I am not sure how to best generate the Grid of Users, Links, and Permissions.
As well as how submitting all that data could be processed in the backend to save all settings.
I will post more progress as it comes but right now I could use some direction please?
I realize i'll need to query and get all users as well as all links and then all user_link_permissions but I am at a loss as to how to create this grid and make it all correspond with the correct values, etc.
UPDATE:
I just found this link which seems to do something similar which looks like a good reference. It even saves the grid value with AJAX which should simplify things and load I believe. http://runastartup.com/how-to-update-a-mysql-field-in-a-multi-table-matrix/

XAMPP and disabled advanced features

Absolutely cannot get rid of these errors in phpmyadmin Version information: 4.2.11
$cfg['Servers'][$i]['users'] ... not OK [ Documentation ]
$cfg['Servers'][$i]['usergroups'] ... not OK [ Documentation ]
Configurable menus: Disabled
$cfg['Servers'][$i]['navigationhiding'] ... not OK [ Documentation ]
Hide/show navigation items: Disabled
$cfg['Servers'][$i]['savedsearches'] ... not OK [ Documentation ]
Saving Query-By-Example searches: Disabled
I have tried the following:
ran SQL
CREATE TABLE IF NOT EXISTS `pma_users` (
`username` varchar(64) NOT NULL,
`usergroup` varchar(64) NOT NULL,
PRIMARY KEY (`username`,`usergroup`)
)
COMMENT='Users and their assignments to user groups'
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
CREATE TABLE IF NOT EXISTS `pma_usergroups` (
`usergroup` varchar(64) NOT NULL,
`tab` varchar(64) NOT NULL,
`allowed` enum('Y','N') NOT NULL DEFAULT 'N',
PRIMARY KEY (`usergroup`,`tab`,`allowed`)
)
COMMENT='User groups with configured menu items'
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
CREATE TABLE IF NOT EXISTS `pma_navigationhiding` (
`username` varchar(64) NOT NULL,
`item_name` varchar(64) NOT NULL,
`item_type` varchar(64) NOT NULL,
`db_name` varchar(64) NOT NULL,
`table_name` varchar(64) NOT NULL,
PRIMARY KEY (`username`,`item_name`,`item_type`,`db_name`,`table_name`)
)
COMMENT='Hidden items of navigation tree'
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
Then updated my config.inc.php with
$cfg['Servers'][$i]['users'] = 'pma_users';
$cfg['Servers'][$i]['usergroups'] = 'pma_usergroups';
$cfg['Servers'][$i]['navigationhiding'] = 'pma_navigationhiding';
Then flushed table caches and restarted phpMyAdmin. The tables for pma_users and uaergroups have been created, but I still get the errors.
PLEASE HELP! This is causing serious issues with my drupal functionality.
Note, I have not yet set root or pma_user passwords.
Ultimately my solution to this problem was to move away from XAMPP local hosting. I moved my site files to remote server, and installed my database and imported my database to their phpyadmin without any issue. Site is now connecting and working beautifully. Spending countless hours following every post I could find and referring to the phpmyadmin documentation were to no avail as opposed to just abandoning ship and going with potentially a more novice user like myself. This worked for me because the remote hosting option was a viable. Unfortunately this answer is not helpful to those whom still need local hosting environment and are using XAMPP. I have the Aquia Dev Desktop that included XAMPP with great success in the past and maybe good option some.

Getting extra column 'require_validation' when asking for table columns

When using the query
select distinct(column_name) as column_name, data_type from information_schema.columns
where table_name='reg_add_ons' order by ordinal_position
I get an extra column on my dev server. On my local server everything works fine. This is the only table this happens on. I have tried dropping the table and adding it again with this statement
delimiter $$
CREATE TABLE `reg_add_ons` (
`add_on_id` int(10) NOT NULL AUTO_INCREMENT,
`eventcode` varchar(20) DEFAULT NULL,
`add_on_desc` varchar(250) DEFAULT NULL,
`add_on_price` decimal(10,2) DEFAULT NULL,
`add_on_detail` text,
`add_on_label` varchar(100) DEFAULT NULL,
`add_on_choices` varchar(200) DEFAULT NULL,
`image_name` varchar(100) DEFAULT NULL,
`internal_only` varchar(2) DEFAULT NULL,
`assign_code` text,
`reg_status` varchar(50) DEFAULT 'Active',
PRIMARY KEY (`add_on_id`)
) ENGINE=MyISAM AUTO_INCREMENT=89 DEFAULT CHARSET=latin1$$
I have a bit of the flu so this is not making sense to me right now.
Dev box is a Windows 7 machine running MySQL 5.6.10
Localhost is Windows 7 running MySQL 5.5.24
Production server is Linux MySQL 5.0.45
It is only this one table on this one machine (Dev) having problems. what is the field require_validation? Where does it come from?
Any insight is appreciated

How to insert images into the database and fetch it from the database and display using PHP?

How do I insert images into the database, and fetch it from the database and display using PHP?
I have tried many times as i am a beginner of php please help me out.
You can use a BLOB field for storing binary data, but please be aware that the performance may be moderate. It's almost always better to store the image as a file on disk and just store the file name in the database. To fetch the image from db, you will need to read the whole image into memory, which is a waste of resources. It's better to offload the image handling to the web server which can stream the image to the client.
As much as this is not a recommended practice, if you have your heart set on doing this, there are a pile of tutorials online which will walk you through how to do this:
Uploading Files To MySQL Database
Upload a File and write to MySQL
Upload Files to MySQL using PHP Tutorial
Uploading files into a MySQL database using PHP
You can create a table like so:
CREATE TABLE `image` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`filename` varchar(128) COLLATE utf8_unicode_ci NOT NULL,
`mime_string` varchar(128) COLLATE utf8_unicode_ci NOT NULL,
`data` longblob NOT NULL,
`data_size` int(11) NOT NULL,
`hash` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
`compressed` tinyint(4) NOT NULL,
`remote_id` int(11) DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `image_I_1` (`hash`),
KEY `image_I_2` (`remote_id`)
) ENGINE=InnoDB AUTO_INCREMENT=125 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ROW_FORMAT=COMPACT
When you write the file back to the output, you'll have to write the HTTP header content type
to the same as the mime type:
header( 'Content-type', 'image/png' );
Which is why you store the mime type along with it.

Categories