Tag Archives: phpmyadmin

MySQL: How to Change the Next Auto Increment Value in phpMyAdmin Tips, Tricks and Tutorials 12 FEB 2015

I needed a quick fix to an urgent problem the other day, and the best solution for that particular challenge turned out to be artificially manipulating tables’ ID primary keys in order to avoid clashes in a shared table when it came to foreign key entries. To do this I needed to set the ID keys of the different MySQL tables into different ranges, and to do that, I would need to manipulate or change the table’s auto_increment value to ensure that the next assigned ID value would be in my preferred range.

As it turns out, later versions of phpMyAdmin exposes this table property very nicely, making it particularly easy to change the auto increment value to whatever you want it to be.

To do this, select the table that you wish to make the change to. Once loaded, navigate to the Operations tab. The resulting screen will have a fieldset entitled Table options. If you look carefully, you’ll spot a field entitled AUTO_INCREMENT. This is the next auto incremented value the table will be using on the next row insert, and so this is the one you want to manipulate.

Change it to a valid entry for the currently applied to field type and hit ‘Go’ to save your change.

phpmyadmin operations change auto increment value

Literally as easy as that.

Related Link: http://www.phpmyadmin.net/home_page/index.php

Ubuntu Server 12.04: How to Enable phpMyAdmin Tips, Tricks and Tutorials 01 JUL 2014

The last little while I’ve slowly been bringing all our servers up to a base level of operating system, in this case Ubuntu Server 12.04 LTS (Waiting for 14.04 LTS to become a little more ‘in use’ before making the jump), and I came across a server that didn’t have the ubiquitous phpMyAdmin installed. We’re (Touchwork) essentially a LAMP development house, which of course then means that phpMyAdmin is almost always present as a nice quick and easy database manager for the simple stuff.

Anyway, to add it to an existing Ubuntu Server install is pretty simple as one would expect, so these notes are more for my own reference than anything else:

sudo apt-get update
sudo apt-get install phpmyadmin

The installer will ask you to set up for either Apache2 or lighttpd and from there it is a matter of following the onscreen instructions. You’ll be asked for the MySQL root password which would have been set during the MySQL server install, so be sure to have that on hand. (Note, the default install directory will be /etc/phpmyadmin, so all the config files will be there for later on tweaking if you are so inclined).

Chances are pretty high that when you hit your server at the expected phpmyadmin URL (e.g. http://myserver.com/phpmyadmin) you’ll be served with a Page Not Found error, which you can then fix by simply telling Apache that it should be expecting phpMyAdmin – basically just include line below (it should be missing) at the end of the /etc/apache2/apache2.conf configuration file:

include /etc/phpmyadmin/apache.conf

Save your changes and restart or reload the apache2 service:

sudo service apache2 reload

Quick and painless.

phpmyadmin-logo-banner

How to Rename a Table using phpMyAdmin Software & Sites 27 APR 2012

It is not immediately apparent how you go about changing the name of a MySQL database table via the phpMyAdmin interface, so I thought I would drop a quick note here to remind me how to do it in the future.

To rename a table in phpMyAdmin, select the targeted table from the database table list in the left hand column.

You’ll see that the breadcrumb navigation will now indicate that you are in the desired tabled (server -> database -> table), and you will now have to click on the Operations tab (near the right hand side of the screen).

In the Table Options fieldset you will find a text box with the label reading “Rename table to”. Simply enter the new name that you wish to rename the table to, and hit the Go button at the bottom of the fieldset.

As easy as that.

Ubuntu: Change the File Size Limit for phpMyAdmin SQL Dump Imports CodeUnit 19 NOV 2010

phpmyadmin logoWorking with the web-based phpMyAdmin can sometimes be a bit of a lesson in frustration, particularly when you start bumping your head against its various limitations. One such annoying limit is the default 2MB upload limit applied for SQL file imports.

The good news is that this limit is actually not a hard and fast part of phpMyAdmin any more – and changing it to something a bit larger to handle those bigger databases is pretty simple to achieve!

So let’s get started then.

The size limitation is actually controlled by the PHP implementation powering the web server that is dishing up the phpMyAdmin portal, meaning that changing the default limits imposed by the PHP configuration will in turn adjust the limits imposed by phpMyAdmin.

The first step is thus to open up the php.ini configuration file for editing.

gksudo gedit /etc/php5/apache2/php.ini

Once open, search for the following three settings and adjust them accordingly to suit your upload needs – e.g. change 2M to 16M.

...

Ubuntu: Simple Install for PHPMyAdmin CodeUnit 03 NOV 2010

PHPMyAdmin is a useful web-based management tool for your MySQL server running as part of your LAMP stack. To install this tool in Ubuntu turns out to be pretty simple after all.

Assuming your Apache webserver, MySQL and PHP are all already installed and up and running, open a new terminal, enter:

sudo apt-get install phpmyadmin

Follow the onscreen prompts and the installation should be complete in no time at all.

The next step is crucial if you installed the phpmyadmin to its default folder in Ubuntu – which unfortunately is not the same as the web folder! One way to fix this is to simply create a symlink like so:

sudo ln -s /usr/share/phpmyadmin/ /var/www/phpmyadmin

This basically corrects the server into serving up the phpmyadmin pages when hitting the default URL http://localhost/phpmyadmin.

And that’s that, simple as pie!

(Ubuntu 10.10 Maverick Meerkat)

How to Store Decimal Currency Values in MySQL CodeUnit 17 JAN 2010

Now while storing integers and numerals in MySQL is pretty rock solid and easy to do, storing decimal values like currency, in other words money, isn’t quite as intuitive when you have a phpMyAdmin structure tab open in front of you.

When it comes to storing non integer numbers, you pretty much have the choice of taking either the FLOAT or DECIMAL route. Now FLOAT is intended for very large values and rounds as a floating point, which is a bit of a problem at times because floating point arithmetic is not entirely exact, particularly when it comes to rounding – which is definitely not a behaviour you want went it comes to adding and subtracting all those cents in any of your financial applications.

DECIMAL was introduced as an “exact packed decimal number”, but prior to MySQL 5.0, any calculations performed on a DECIMAL type column would be done using floating point arithmetic, which didn’t really solve the problem. However, starting with MySQL 5.0 and above, the server now uses a separate fixed-point arithmetic library for this, making it far more precise and far less prone to rounding errors.

Thus the best way to currently store your money value in whatever currency, be it in Rands or US Dollars is to declare a DECIMAL column type and assign it a length/value of 10,2 (where 2 indicates the length of the fractional part of the number).

(Of course you could always be a Smart Alec and simply save everything as cents in the first place)