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 4031024
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:32:44+00:00 2026-05-20T11:32:44+00:00

I often find the need to check a table structure (to check column names

  • 0

I often find the need to check a table structure (to check column names for instance when writing a PHP script). My one single purpose is: speed. I use “Adminer” and in a few clicks I can check it out. But I want to do this faster, with a command line window I have always open anyway. So I’d like to create a function that allows me to do something like:

mysql -uuser -ppassword && USE database; && DESCRIBE table;

I would alias this in a way that I can call:

describe database.table

And voilá, I get the database structure. But my issue is: how can I log into MySQL AND run certain queries in one script?? I have not found a way to do this.

  • 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-20T11:32:45+00:00Added an answer on May 20, 2026 at 11:32 am
    mysql database -uuser -ppassword -e "describe table;"
    

    For example:

    mysql -uuser -ppassword mysql -e "describe time_zone;"
    +------------------+------------------+------+-----+---------+----------------+
    | Field            | Type             | Null | Key | Default | Extra          |
    +------------------+------------------+------+-----+---------+----------------+
    | Time_zone_id     | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
    | Use_leap_seconds | enum('Y','N')    | NO   |     | N       |                |
    +------------------+------------------+------+-----+---------+----------------+
    

    If you’re looking for a way to alias this in your shell, you can use a function, like this:

    function describe() { mysql -uuser -ppassword $1 -e "describe $2;"; }
    describe mysql time_zone
    +------------------+------------------+------+-----+---------+----------------+
    | Field            | Type             | Null | Key | Default | Extra          |
    +------------------+------------------+------+-----+---------+----------------+
    | Time_zone_id     | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
    | Use_leap_seconds | enum('Y','N')    | NO   |     | N       |                |
    +------------------+------------------+------+-----+---------+----------------+
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I often find the need to do something along these lines: public class OperationResult
Often I find myself filling ASP.NET repeaters with items that need the CSS class
Here at work, we often need to find a string from the list of
I often find myself writing a property that is evaluated lazily. Something like: if
I seem to often find myself wanting to store data of more than one
While creating classes in Java I often find myself creating instance-level collections that I
When I'm writing a method or using a member variable, I often find I
In Emacs, I often find myself in a situation where I need to jump
In my day-to-day work, I often find myself writing classes like in this simplified
I often find myself using Integers to represent values in different spaces. For example...

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.