10 commands to manage databases with MySQLAdmin

For years I have always managed my MySQL databases by entering the MySQL server and executing the instructions, that is:

mysql -u root -p

And here I write the password and I can do what I want, however I just discovered: mysqladmin

MySQL version and status?

First, let's check the version of MySQL that is installed:

mysqladmin -u root -p ping

O well:

sudo service mysql status

In my case I get this:

mysql-status-alive

Still, they can know the version of MySQL that is running with:

mysqladmin -u root -p version

How to set or change password to root in MySQL?

In many distros when a MySQL server is installed it is not always configured with a root password by default for MySQL, to establish a password for root when it does not have it is as simple as:

mysqladmin -u root password PASSWORD-QUE-QUIERAN

If not, and they do have a password for root but want to change it, the syntax is as follows:

mysqladmin -u root -pPASSWORD-QUE-TIENEN password 'NUEVO-PASSWORD'

How to create a database in MySQL?

As simple as running:

mysqladmin -u root -p create NOMBRE-DE-DB

How to delete a database in MySQL?

Very similar to the previous instruction:

mysqladmin -u root -p drop NOMBRE-DE-DB

How to know what connections there are to the MySQL server?

mysqladmin -u root -p status

At the moment I write this article on my laptop it shows me the following:

Uptime: 19381 Threads: 1 Questions: 9518 Slow queries: 0 Opens: 431 Flush tables: 1 Open tables: 106 Queries per second avg: 0.491

Likewise, if you want to know all the values ​​and conditions of the variables, just put:

mysqladmin -u root -p extended-status

The output will be much more extensive this time.

Or if this doesn't tell you the information you need, try:

mysqladmin -u root -p variables

In case you want to reload the privileges, that is, make a flush the command would be:

mysqladmin -u root -p reload;
mysqladmin -u root -p refresh

All these commands work with the MySQL server being in localhost, if you want to execute instructions on a remote server you must add:

-h IP-DE-SERVIDOR

Anyway, I know that many prefer PHPMyAdmin and others simply prefer the terminal, here we have some tips for the terminal 😉

If you want to know more about MySQLAdmin you already know - » mysqladmin --help

regards


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   eliotime3000 said

    Notice to the editor of the post that the image could not be viewed or there are problems with the directory permissions to view the graphic.

    1.    KZKG ^ Gaara said

      I correct it right now, thanks 🙂

      1.    likewho said

        Still not seen 😮

        1.    sieg84 said

          right away, the change is applied

          1.    eliotime3000 said

            So far, I don't see anything at all. The easiest thing is to upload the image to Imgur, then you link it and that's it.

          2.    KZKG ^ Gaara said

            It's fixed, sorry for the delay ... I had trouble getting online these days.

  2.   elav said

    Mmm .. I can't see the image either, it seems that "someone" put his fingers where he shouldn't 😀

  3.   nathan said

    Learn Microsoft Access, don't waste time with this. Nobody uses it

    1.    elav said

      JAAAAAAAAAAAAAAAAAAAAAJAJAJAJAJAJAJAJAJAAJAJA… Microsoft Access? Seriously? Good grief, what to read ...

      1.    eliotime3000 said

        I also say the same, although MySQL seems much easier to handle than Access in terms of its functionalities (and more if you do it from the console).

        1.    elav said

          Is that Access is not at all the same as MySQL. Let's see Who manages the DB of a site using Access?

          1.    pandev92 said

            is that acces does not do the same function LOL!

    2.    eliotime3000 said

      In Peru, they do use it a lot in MyPES, even so the actual use that this system is given is minimal, without considering that it is quite weak compared to MySQL / MariaDB, PostgreSQL and gang.

    3.    Rodolfo said

      Friend Access is not a DB as such, sql server yes, access is like a small simulation of DB, Mysql if it is a database engine, which in these times has many things that proprietary DBs, nothing to envy to other engines by DB.

      Did you know that internet hosts give native support to mysql? many cms such as drupal, joomla, wordpress and everything related to web applications in most cases use mysql, where they teach you for sure that they are doing something basic and that is why they use access, but it is necessary that you read and find out about engines or managers of databases.

      1.    Angel said

        Rodolfo Yes You Know Thank You
        Acces is not a DB acces is a proprietary Guindous program

  4.   eliotime3000 said

    Surely, the problem was due to the fact that KZKGGaara was playing with the VPN's BD and totally made the image not visible.

  5.   clown said

    In the case of being so useless that none of the commands worked for you, copy this command in a terminal:

    ~ # sudo apt-get -y remove --purge mysql

    1.    eliotime3000 said

      JAJAJAJAJAJAJAJAJAJAJAJAAAAAAAAAAAA !!!!!!

      I can't believe they threw in the towel so quickly with MySQL.

  6.   cyborg said

    Hello
    access is used by those who can't afford anything better, and any large company uses mysql,
    stop being a troll

    1.    eliotime3000 said

      That is why in Peru, being hyper-dependent on Microsoft, it is using its products exhaustively (among them, Access and SQL Server).

  7.   janus981 said

    I think an important command is missing: mysql -u root -p source db-name used to import a database. Regards.

    1.    eliotime3000 said

      I know that since I was taught MySQL with Windows.

  8.   William said

    So far I have not found a great new tool to work with MySQL - Valentina Studio. It's the free edition you can do more than the many commercial tools!
    Highly recommended to check it out. http://www.valentina-db.com/en/valentina-studio-overview

  9.   Mario Riveros said

    How to Manage db mysql in centos 6 with windows client

  10.   Manuel Lucero placeholder image said

    Estimated.

    How can I know by console in a linux server, the installed database engines?

    Thank you.
    Atte.
    ML

    1.    KZKG ^ Gaara said

      Hello,

      Well assuming you use a distro like Debian that has the aptitude command already installed, you could check like this:

      aptitude search mysql | grep server

      This will tell you whether or not the MySQL server is installed

      You could try the same with Postgre.

      Remember that the first letter on the left is the indicator. P means it is not installed, I means it is installed.

  11.   John Paul Moreno said

    I loved this information, it is very interesting 😉
    thank you for everything…