1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to start/stop/restart MySQL via terminal commands?

Discussion in 'MySQL' started by 2Charlie, Mar 8, 2017.

  1. #1
    I've tried the following:

    sudo /usr/local/mysql/support-files/mysql.server restart
    Password:
    ERROR! MySQL server PID file could not be found!
    Starting MySQL
    .Logging to '/usr/local/mysql/data/mycompx.err'.
    .................................................................................................... ERROR! The server quit without updating PID file (/usr/local/mysql/data/mycompx.pid).

    I've tried:

    $ mysql.server start
    zsh: command not found: mysql.server

    And tried:

    $ sudo service mysql stop
    Password:
    sudo: service: command not found

    Here's path variables.

    /Users/userName/.rvm/gems/ruby-2.3.0/bin:/Users/userName/.rvm/gems/ruby-2.3.0@global/bin:/Users/userName/.rvm/rubies/ruby-2.3.0/bin:/Users/userName/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/DevDesktop/drush:/Users/userName/.rvm/bin
     
    2Charlie, Mar 8, 2017 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    What OS/hosting platform is this running on?
     
    jestep, Mar 10, 2017 IP
  3. Dynadot

    Dynadot Active Member

    Messages:
    33
    Likes Received:
    5
    Best Answers:
    1
    Trophy Points:
    58
    #3
    Have you already tried just:
    #mysql.server restart
     
    Dynadot, Mar 13, 2017 IP
  4. srivin

    srivin Member

    Messages:
    31
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    38
    #4
    What is the platform you running on ?
     
    srivin, Mar 13, 2017 IP
  5. 2Charlie

    2Charlie Greenhorn

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #5
    I'm running on OS X El Capitan version 10.11.5. I do not use MAMP or WAMP. I'm running it on my local machine at this point for local development only.
     
    2Charlie, Mar 13, 2017 IP
  6. 2Charlie

    2Charlie Greenhorn

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #6
    Yes, I tried that too. It didn't work. The only thing that works is if I restart my MacBook Pro.
     
    2Charlie, Mar 13, 2017 IP
  7. Zoti Media Group

    Zoti Media Group Notable Member

    Messages:
    1,598
    Likes Received:
    113
    Best Answers:
    2
    Trophy Points:
    265
    Digital Goods:
    2
    #7
    Last edited: Mar 13, 2017
    Zoti Media Group, Mar 13, 2017 IP
  8. 2Charlie

    2Charlie Greenhorn

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #9
    I've the command:
    sudo /usr/local/mysql/support-files/mysql.server restart

    And I got: command not found

    In my .zshrc file, I have the folowing:

    export PATH=$HOME/bin:/usr/local/bin:/usr/local/mysql/bin:$PATH

    #alias for Drush to know where php and mysql location
    export DRUSH_PHP=/usr/local/bin/php
    export DRUSH_SQL=/usr/local/mysql/bin/mysql

    # Path to your oh-my-zsh installation.
    export ZSH=/Users/charlie/.oh-my-zsh
     
    Last edited by a moderator: Mar 14, 2017
    2Charlie, Mar 14, 2017 IP
  9. srivin

    srivin Member

    Messages:
    31
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    38
    #9
    I dont know much about mac os systems :( In your mysql config file (my.cnf) check where its pointed the pid-file. If its not there add it manually and created the dorectory (/var/mkdir /var/run/mysqld) and file ( /var/run/mysqld/mysqld.pid ) and set permission.

    pid-file = /var/run/mysqld/mysqld.pid

    Permission : chown -R mysql:mysql /var/run/mysqld


    Source : http://serverfault.com/questions/480889/mysql-server-pid-file-could-not-be-found

    Best Regards !
     
    srivin, Mar 14, 2017 IP
  10. 2Charlie

    2Charlie Greenhorn

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #10
    Is there a way to check if I have more than one MySQL installed on my machine? I think I've might have installed MySQL via brew and then I downloaded and manually installed MySQL again from the MySQL website. So, perhaps this may be the root issue of my situation. If I can use brew to manage my MySQL that I manually installed, I like to keep that. If not, then I need to uninstall the MySQL version that was installed by brew. But first, I need to verify if I have two versions or not and how do I do that?
     
    2Charlie, Mar 15, 2017 IP
  11. srivin

    srivin Member

    Messages:
    31
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    38
    #11
    You can view list of installed packages with brew by command "brew list" .

    Best Regards !
     
    srivin, Mar 16, 2017 IP
  12. pmf123

    pmf123 Notable Member

    Messages:
    1,447
    Likes Received:
    75
    Best Answers:
    0
    Trophy Points:
    215
    #12
    /sbin/service mysqld restart
     
    pmf123, Mar 22, 2017 IP