Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7609311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:08:32+00:00 2026-05-31T01:08:32+00:00

Earlier today, I asked for an easy way to store a version number for

  • 0

Earlier today, I asked for an easy way to store a version number for the SQL table layout you are using in SQLite, and got the suggestion to use PRAGMA user_version. As there is no such thing as a Pragma in MySQL, I was wondering on how you would go about this in MySQL (Except for creating a table named “META” with a column “DB-Scheme-Version”).

Just to repeat what I said in the linked question: I’m not looking for a way to find out which version of MySQL is installed, but to save a version nuber that tells me what version of my MySQL-Scheme I am using, without checking every table via script.

I also saw this question, but it only allows me to version single tables. Is there something similar or, preferably, easier, for whole Databases (Since it would be no fun to query every single table seperately)? Thanks in advance.

MySQL’s SET GLOBAL would probably work, but I prefer a solution that does not reset itself every time the server reboots and does not require SUPER Privilege and / or access to the configuration file to use. To put it short: It should work with a standard MySQL-Database that you get when you rent a small webhosting package, not the ones you get if you rent a full server, as you tend to have more access to those.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T01:08:33+00:00Added an answer on May 31, 2026 at 1:08 am

    There are a couple of choices, depending on the privileges that you have. The higher privileges you have, the more “elegant” the solution.

    The most direct route is to create a stored function, which requires the CREATE ROUTINE privilege. e.g.

    mysql> CREATE FUNCTION `mydb`.DB_VERSION() RETURNS VARCHAR(15)
           RETURN '1.2.7.2861';
    Query OK, 0 rows affected (0.03 sec)
    
    mysql> SELECT `mydb`.DB_VERSION();
    +--------------+
    | DB_VERSION() |
    +--------------+
    | 1.2.7.2861   |
    +--------------+
    1 row in set (0.06 sec)
    

    If your privileges limit you to only creating tables, you can create a simple table and put the version in a default value:

    mysql> CREATE TABLE `mydb`.`db_version` (
        `version` varchar(15) not null default '1.2.7.2861');
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> SHOW COLUMNS FROM `mydb`.`db_version`;
    +---------+-------------+------+-----+------------+-------+
    | Field   | Type        | Null | Key | Default    | Extra |
    +---------+-------------+------+-----+------------+-------+
    | version | varchar(15) | NO   |     | 1.2.7.2861 |       |
    +---------+-------------+------+-----+------------+-------+
    1 row in set (0.00 sec)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Earlier today, I asked a question about the way Python handles certain kinds of
This is a revised/better written version of the question I asked earlier today --
I asked this goofy question earlier today and got good answers. I think what
Earlier today I asked a question about configuring log4net from code and got an
I asked a question earlier today regarding using Perl to search in a CSS
I asked a question here earlier today and got that fixed, but now I
Earlier today I asked a question about environ , and one of the more
Earlier today I asked a question about passing dictionary values to a function. While
Earlier today a question was asked regarding input validation strategies in web apps .
I asked a question earlier today ( Methods of Managing Source Code ) as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.