Using phpMyAdmin

6.1 I can't insert new rows into a table / I can't create a table - MySQL brings up a SQL error.

Examine the SQL error with care. Often the problem is caused by specifying a wrong column-type. Common errors include:

Also, look at the syntax chapter in the MySQL manual to confirm that your syntax is correct.

6.2 When I create a table, I set an index for two columns and phpMyAdmin generates only one index with those two columns.

This is the way to create a multi-columns index. If you want two indexes, create the first one when creating the table, save, then display the table properties and click the Index link to create the other index.

6.3 How can I insert a null value into my table?

Since version 2.2.3, you have a checkbox for each column that can be null. Before 2.2.3, you had to enter "null", without the quotes, as the column's value. Since version 2.5.5, you have to use the checkbox to get a real NULL value, so if you enter "NULL" this means you want a literal NULL in the column, and not a NULL value (this works in PHP4).

6.4 How can I backup my database or table?

Click on a database or table name in the navigation panel, the properties will be displayed. Then on the menu, click "Export", you can dump the structure, the data, or both. This will generate standard SQL statements that can be used to recreate your database/table. You will need to choose "Save as file", so that phpMyAdmin can transmit the resulting dump to your station. Depending on your PHP configuration, you will see options to compress the dump. See also the $cfg['ExecTimeLimit'] configuration variable. For additional help on this subject, look for the word "dump" in this document.

6.5 How can I restore (upload) my database or table using a dump? How can I run a ".sql" file?

Click on a database name in the navigation panel, the properties will be displayed. Select "Import" from the list of tabs in the right-hand frame (or "SQL" if your phpMyAdmin version is previous to 2.7.0). In the "Location of the text file" section, type in the path to your dump filename, or use the Browse button. Then click Go. With version 2.7.0, the import engine has been re-written, if possible it is suggested that you upgrade to take advantage of the new features. For additional help on this subject, look for the word "upload" in this document.

Note: For errors while importing of dumps exported from older MySQL versions to newer MySQL versions, please check 6.41 I get import errors while importing the dumps exported from older MySQL versions (pre-5.7.6) into newer MySQL versions (5.7.7+), but they work fine when imported back on same older versions ?.

6.6 How can I use the relation table in Query-by-example?

Here is an example with the tables persons, towns and countries, all located in the database "mydb". If you don't have a pma__relation table, create it as explained in the configuration section. Then create the example tables:

CREATE TABLE REL_countries ( country_code char(1) NOT NULL default '', description varchar(10) NOT NULL default '', PRIMARY KEY (country_code) ) ENGINE=MyISAM;  INSERT INTO REL_countries VALUES ('C', 'Canada');  CREATE TABLE REL_persons ( id tinyint(4) NOT NULL auto_increment, person_name varchar(32) NOT NULL default '', town_code varchar(5) default '0', country_code char(1) NOT NULL default '', PRIMARY KEY (id) ) ENGINE=MyISAM;  INSERT INTO REL_persons VALUES (11, 'Marc', 'S', 'C'); INSERT INTO REL_persons VALUES (15, 'Paul', 'S', 'C');  CREATE TABLE REL_towns ( town_code varchar(5) NOT NULL default '0', description varchar(30) NOT NULL default '', PRIMARY KEY (town_code) ) ENGINE=MyISAM;  INSERT INTO REL_towns VALUES ('S', 'Sherbrooke'); INSERT INTO REL_towns VALUES ('M', 'Montréal'); 

To setup appropriate links and display information:

Then test like this:

6.7 How can I use the "display column" feature?

Starting from the previous example, create the pma__table_info as explained in the configuration section, then browse your persons table, and move the mouse over a town code or country code. See also 6.21 In edit/insert mode, how can I see a list of possible values for a column, based on some foreign table? for an additional feature that "display column" enables: drop-down list of possible values.

6.8 How can I produce a PDF schema of my database?

First the configuration variables "relation", "table_coords" and "pdf_pages" have to be filled in. Then you need to think about your schema layout. Which tables will go on which pages?

See also

Relations

6.9 phpMyAdmin is changing the type of one of my columns!

No, it's MySQL that is doing silent column type changing.

6.10 When creating a privilege, what happens with underscores in the database name?

If you do not put a backslash before the underscore, this is a wildcard grant, and the underscore means "any character". So, if the database name is "john_db", the user would get rights to john1db, john2db … If you put a backslash before the underscore, it means that the database name will have a real underscore.

6.11 What is the curious symbol ø in the statistics pages?

It means "average".

6.12 I want to understand some Export options.

Structure:

Data:

6.13 I would like to create a database with a dot in its name.

This is a bad idea, because in MySQL the syntax "database.table" is the normal way to reference a database and table name. Worse, MySQL will usually let you create a database with a dot, but then you cannot work with it, nor delete it.

6.14 (withdrawn).

6.15 I want to add a BLOB column and put an index on it, but MySQL says "BLOB column '…' used in key specification without a key length".

The right way to do this, is to create the column without any indexes, then display the table structure and use the "Create an index" dialog. On this page, you will be able to choose your BLOB column, and set a size to the index, which is the condition to create an index on a BLOB column.

6.16 How can I simply move in page with plenty editing fields?

You can use Ctrl+arrows (Option+Arrows in Safari) for moving on most pages with many editing fields (table structure changes, row editing, etc.).

6.17 Transformations: I can't enter my own mimetype! What is this feature then useful for?

Defining mimetypes is of no use if you can't put transformations on them. Otherwise you could just put a comment on the column. Because entering your own mimetype will cause serious syntax checking issues and validation, this introduces a high-risk false- user-input situation. Instead you have to initialize mimetypes using functions or empty mimetype definitions.

Plus, you have a whole overview of available mimetypes. Who knows all those mimetypes by heart so they can enter it at will?

6.18 Bookmarks: Where can I store bookmarks? Why can't I see any bookmarks below the query box? What are these variables for?

You need to have configured the phpMyAdmin configuration storage for using bookmarks feature. Once you have done that, you can use bookmarks in the SQL tab.

See also

Bookmarks

6.19 How can I create simple LATEX document to include exported table?

You can simply include table in your LATEX documents, minimal sample document should look like following one (assuming you have table exported in file table.tex):

\documentclass{article} % or any class you want \usepackage{longtable}  % for displaying table \begin{document}        % start of document \include{table}         % including exported table \end{document}          % end of document 

6.20 I see a lot of databases which are not mine, and cannot access them.

You have one of these global privileges: CREATE TEMPORARY TABLES, SHOW DATABASES, LOCK TABLES. Those privileges also enable users to see all the database names. So if your users do not need those privileges, you can remove them and their databases list will shorten.

6.21 In edit/insert mode, how can I see a list of possible values for a column, based on some foreign table?

You have to setup appropriate links between the tables, and also setup the "display column" in the foreign table. See 6.6 How can I use the relation table in Query-by-example? for an example. Then, if there are 100 values or less in the foreign table, a drop-down list of values will be available. You will see two lists of values, the first list containing the key and the display column, the second list containing the display column and the key. The reason for this is to be able to type the first letter of either the key or the display column. For 100 values or more, a distinct window will appear, to browse foreign key values and choose one. To change the default limit of 100, see $cfg['ForeignKeyMaxLimit'].

6.22 Bookmarks: Can I execute a default bookmark automatically when entering Browse mode for a table?

Yes. If a bookmark has the same label as a table name and it's not a public bookmark, it will be executed.

See also

Bookmarks

6.23 Export: I heard phpMyAdmin can export Microsoft Excel files?

You can use CSV for Microsoft Excel, which works out of the box.

Changed in version 3.4.5: Since phpMyAdmin 3.4.5 support for direct export to Microsoft Excel version 97 and newer was dropped.

6.24 Now that phpMyAdmin supports native MySQL 4.1.x column comments, what happens to my column comments stored in pmadb?

Automatic migration of a table's pmadb-style column comments to the native ones is done whenever you enter Structure page for this table.

6.25 (withdrawn).

6.26 How can I select a range of rows?

Click the first row of the range, hold the shift key and click the last row of the range. This works everywhere you see rows, for example in Browse mode or on the Structure page.

6.27 What format strings can I use?

In all places where phpMyAdmin accepts format strings, you can use @VARIABLE@ expansion and strftime format strings. The expanded variables depend on a context (for example, if you haven't chosen a table, you can not get the table name), but the following variables can be used:

@HTTP_HOST@
HTTP host that runs phpMyAdmin
@SERVER@
MySQL server name
@VERBOSE@
Verbose MySQL server name as defined in $cfg['Servers'][$i]['verbose']
@VSERVER@
Verbose MySQL server name if set, otherwise normal
@DATABASE@
Currently opened database
@TABLE@
Currently opened table
@COLUMNS@
Columns of the currently opened table
@PHPMYADMIN@
phpMyAdmin with version

6.28 How can I easily edit relational schema for export?

By clicking on the button 'toggle scratchboard' on the page where you edit x/y coordinates of those elements you can activate a scratchboard where all your elements are placed. By clicking on an element, you can move them around in the pre-defined area and the x/y coordinates will get updated dynamically. Likewise, when entering a new position directly into the input field, the new position in the scratchboard changes after your cursor leaves the input field.

You have to click on the 'OK'-button below the tables to save the new positions. If you want to place a new element, first add it to the table of elements and then you can drag the new element around.

By changing the paper size and the orientation you can change the size of the scratchboard as well. You can do so by just changing the dropdown field below, and the scratchboard will resize automatically, without interfering with the current placement of the elements.

If ever an element gets out of range you can either enlarge the paper size or click on the 'reset' button to place all elements below each other.

6.29 Why can't I get a chart from my query result table?

Not every table can be put to the chart. Only tables with one, two or three columns can be visualised as a chart. Moreover the table must be in a special format for chart script to understand it. Currently supported formats can be found in Charts.

6.30 Import: How can I import ESRI Shapefiles?

An ESRI Shapefile is actually a set of several files, where .shp file contains geometry data and .dbf file contains data related to those geometry data. To read data from .dbf file you need to have PHP compiled with the dBase extension (-enable-dbase). Otherwise only geometry data will be imported.

To upload these set of files you can use either of the following methods:

Configure upload directory with $cfg['UploadDir'], upload both .shp and .dbf files with the same filename and chose the .shp file from the import page.

Create a zip archive with .shp and .dbf files and import it. For this to work, you need to set $cfg['TempDir'] to a place where the web server user can write (for example './tmp').

To create the temporary directory on a UNIX-based system, you can do:

cd phpMyAdmin mkdir tmp chmod o+rwx tmp 

6.31 How do I create a relation in designer?

To select relation, click: The display column is shown in pink. To set/unset a column as the display column, click the "Choose column to display" icon, then click on the appropriate column name.

6.32 How can I use the zoom search feature?

The Zoom search feature is an alternative to table search feature. It allows you to explore a table by representing its data in a scatter plot. You can locate this feature by selecting a table and clicking the Search tab. One of the sub-tabs in the Table Search page is Zoom Search.

Consider the table REL_persons in 6.6 How can I use the relation table in Query-by-example? for an example. To use zoom search, two columns need to be selected, for example, id and town_code. The id values will be represented on one axis and town_code values on the other axis. Each row will be represented as a point in a scatter plot based on its id and town_code. You can include two additional search criteria apart from the two fields to display.

You can choose which field should be displayed as label for each point. If a display column has been set for the table (see 6.7 How can I use the "display column" feature?), it is taken as the label unless you specify otherwise. You can also select the maximum number of rows you want to be displayed in the plot by specifing it in the 'Max rows to plot' field. Once you have decided over your criteria, click 'Go' to display the plot.

After the plot is generated, you can use the mousewheel to zoom in and out of the plot. In addition, panning feature is enabled to navigate through the plot. You can zoom-in to a certain level of detail and use panning to locate your area of interest. Clicking on a point opens a dialogue box, displaying field values of the data row represented by the point. You can edit the values if required and click on submit to issue an update query. Basic instructions on how to use can be viewed by clicking the 'How to use?' link located just above the plot.

6.33 When browsing a table, how can I copy a column name?

Selecting the name of the column within the browse table header cell for copying is difficult, as the columns support reordering by dragging the header cells as well as sorting by clicking on the linked column name. To copy a column name, double-click on the empty area next to the column name, when the tooltip tells you to do so. This will show you an input box with the column name. You may right-click the column name within this input box to copy it to your clipboard.

6.34 How can I use the Favorite Tables feature?

Favorite Tables feature is very much similar to Recent Tables feature. It allows you to add a shortcut for the frequently used tables of any database in the navigation panel . You can easily navigate to any table in the list by simply choosing it from the list. These tables are stored in your browser's local storage if you have not configured your phpMyAdmin Configuration Storage. Otherwise these entries are stored in phpMyAdmin Configuration Storage.

IMPORTANT: In absence of phpMyAdmin Configuration Storage, your Favorite tables may be different in different browsers based on your different selections in them.

To add a table to Favorite list simply click on the Gray star in front of a table name in the list of tables of a Database and wait until it turns to Yellow. To remove a table from list, simply click on the Yellow star and wait until it turns Gray again.

Using $cfg['NumFavoriteTables'] in your config.inc.php file, you can define the maximum number of favorite tables shown in the navigation panel. Its default value is 10.

6.35 How can I use the Range search feature?

With the help of range search feature, one can specify a range of values for particular column(s) while performing search operation on a table from the Search tab.

To use this feature simply click on the BETWEEN or NOT BETWEEN operators from the operator select list in front of the column name. On choosing one of the above options, a dialog box will show up asking for the Minimum and Maximum value for that column. Only the specified range of values will be included in case of BETWEEN and excluded in case of NOT BETWEEN from the final results.

Note: The Range search feature will work only Numeric and Date data type columns.

6.36 What is Central columns and how can I use this feature?

As the name suggests, the Central columns feature enables to maintain a central list of columns per database to avoid similar name for the same data element and bring consistency of data type for the same data element. You can use the central list of columns to add an element to any table structure in that database which will save from writing similar column name and column definition.

To add a column to central list, go to table structure page, check the columns you want to include and then simply click on "Add to central columns". If you want to add all unique columns from more than one table from a database then go to database structure page, check the tables you want to include and then select "Add columns to central list".

To remove a column from central list, go to Table structure page, check the columns you want to remove and then simply click on "Remove from central columns". If you want to remove all columns from more than one tables from a database then go to database structure page, check the tables you want to include and then select "Remove columns from central list".

To view and manage the central list, select the database you want to manage central columns for then from the top menu click on "Central columns". You will be taken to a page where you will have options to edit, delete or add new columns to central list.

6.37 How can I use Improve Table structure feature?

Improve table structure feature helps to bring the table structure upto Third Normal Form. A wizard is presented to user which asks questions about the elements during the various steps for normalization and a new structure is proposed accordingly to bring the table into the First/Second/Third Normal form. On startup of the wizard, user gets to select upto what normal form they want to normalize the table structure.

Here is an example table which you can use to test all of the three First, Second and Third Normal Form.

CREATE TABLE `VetOffice` (  `petName` varchar(64) NOT NULL,  `petBreed` varchar(64) NOT NULL,  `petType` varchar(64) NOT NULL,  `petDOB` date NOT NULL,  `ownerLastName` varchar(64) NOT NULL,  `ownerFirstName` varchar(64) NOT NULL,  `ownerPhone1` int(12) NOT NULL,  `ownerPhone2` int(12) NOT NULL,  `ownerEmail` varchar(64) NOT NULL, ); 

The above table is not in First normal Form as no primary key exists. Primary key is supposed to be (petName,`ownerLastName`,`ownerFirstName`) . If the primary key is chosen as suggested the resultant table won't be in Second as well as Third Normal form as the following dependencies exists.

(OwnerLastName, OwnerFirstName) -> OwnerEmail (OwnerLastName, OwnerFirstName) -> OwnerPhone PetBreed -> PetType 

Which says, OwnerEmail depends on OwnerLastName and OwnerFirstName. OwnerPhone depends on OwnerLastName and OwnerFirstName. PetType depends on PetBreed.

6.38 How can I reassign auto-incremented values?

Some users prefer their AUTO_INCREMENT values to be consecutive; this is not always the case after row deletion.

Here are the steps to accomplish this. These are manual steps because they involve a manual verification at one point.

6.39 What is the "Adjust privileges" option when renaming, copying, or moving a database, table, column, or procedure?

When renaming/copying/moving a database/table/column/procedure, MySQL does not adjust the original privileges relating to these objects on its own. By selecting this option, phpMyAdmin will adjust the privilege table so that users have the same privileges on the new items.

For example: A user 'bob'@'localhost' has a 'SELECT' privilege on a column named 'id'. Now, if this column is renamed to 'id_new', MySQL, on its own, would not adjust the column privileges to the new column name. phpMyAdmin can make this adjustment for you automatically.

Notes:

Thus, if you want to replicate the database/table/column/procedure as it is while renaming/copying/moving these objects, make sure you have checked this option.

6.40 I see "Bind parameters" checkbox in the "SQL" page. How do I write parameterized SQL queries?

From version 4.5, phpMyAdmin allows users to execute parameterized queries in the "SQL" page. Parameters should be prefixed with a colon(:) and when the "Bind parameters" checkbox is checked these parameters will be identified and input fields for these parameters will be presented. Values entered in these field will be substituted in the query before being executed.

6.41 I get import errors while importing the dumps exported from older MySQL versions (pre-5.7.6) into newer MySQL versions (5.7.7+), but they work fine when imported back on same older versions ?

If you get errors like #1031 - Table storage engine for 'table_name' doesn't have this option while importing the dumps exported from pre-5.7.7 MySQL servers into new MySQL server versions 5.7.7+, it might be because ROW_FORMAT=FIXED is not supported with InnoDB tables. Moreover, the value of innodb_strict_mode would define if this would be reported as a warning or as an error.

Since MySQL version 5.7.9, the default value for innodb_strict_mode is ON and thus would generate an error when such a CREATE TABLE or ALTER TABLE statement is encountered.

There are two ways of preventing such errors while importing:

After the import is done, it is suggested that the value of innodb_strict_mode should be reset to the original value.