Check mySQL version on Mac 10.8.5

后端 未结 4 813
忘了有多久
忘了有多久 2021-02-05 04:38

How can I check (step-by-step ) the version of mySQL installed on my Mac 10.8.5?

I tried using command prompt, but couldn\'t figure out.

相关标签:
4条回答
  • 2021-02-05 05:12

    Or just call mysql command with --version option.

    mysql --version
    
    0 讨论(0)
  • 2021-02-05 05:16

    Every time you used the mysql console, the version is shown.

     mysql -u user
    

    Successful console login shows the following which includes the mysql server version.

    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 1432
    Server version: 5.5.9-log Source distribution
    
    Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql>
    

    You can also check the mysql server version directly by executing the following command:

    mysql --version
    

    You may also check the version information from the mysql console itself using the version variables:

    mysql> SHOW VARIABLES LIKE "%version%";
    

    Output will be something like this:

    +-------------------------+---------------------+
    | Variable_name           | Value               |
    +-------------------------+---------------------+
    | innodb_version          | 1.1.5               |
    | protocol_version        | 10                  |
    | slave_type_conversions  |                     |
    | version                 | 5.5.9-log           |
    | version_comment         | Source distribution |
    | version_compile_machine | i386                |
    | version_compile_os      | osx10.4             |
    +-------------------------+---------------------+
    7 rows in set (0.01 sec)
    

    You may also use this:

    mysql> select @@version;
    

    The STATUS command display version information as well.

    mysql> STATUS
    

    You can also check the version by executing this command:

    mysql -v
    

    It's worth mentioning that if you have encountered something like this:

    ERROR 2002 (HY000): Can't connect to local MySQL server through socket
    '/tmp/mysql.sock' (2)
    

    you can fix it by:

    sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock
    
    0 讨论(0)
  • 2021-02-05 05:20

    You should be able to open terminal and just type

    mysql -v

    0 讨论(0)
  • 2021-02-05 05:29

    To check your MySQL version on your mac, navigate to the directory where you installed it (default is usr/local/mysql/bin) and issue this command:

    ./mysql --version
    

    Alternatively, to avoid needing to navigate to that specific dir to run the command, add its location to your path ($PATH). There's more than one way to add a dir to your $PATH (with explanations on stackoverflow and other places on how to do so), such as adding it to your ./bash_profile.

    After adding the mysql bin dir to your $PATH, verify it's there by executing:

    echo $PATH
    

    Thereafter you can check your mysql version from anywhere by running (note no "./"):

    mysql --version
    
    0 讨论(0)
提交回复
热议问题