Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a pre-existing table that has a column to that can hold a UUID.

I'd like to be able to define a default such that new rows coming in (from legacy systems) will still get a UUID defined, via the UUID() function -- is it possible to configure the default of a column to be a value returned by UUID (in a similar manner to how you can for the UNIX_TIMESTAMP() in phpMyAdmin)

share|improve this question
up vote 7 down vote accepted

Using a trigger

You can't use functions as defaults in MySQL, except for CURRENT_TIMESTAMP for TIMESTAMP columns

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.