Welcome to Centmin Mod Community
Become a Member

Running MySQL query

Discussion in 'System Administration' started by Jon Snow, Aug 23, 2017.

  1. Jon Snow

    Jon Snow Member

    121
    20
    18
    Jun 30, 2017
    Ratings:
    +24
    Local Time:
    1:18 AM
    Nginx 1.13.4
    MariaDB 10.1.26
    I'm in need of running a MySQL query through an SSH client :
    Code:
    DELETE FROM xf_node_type WHERE node_type_id = 'WF_WidgetPage';
    Any advice? (this is xenForo for an add-on)

    I enter the MariaDB monitor but as root and only one database is hosted on the server.
     
  2. eva2000

    eva2000 Administrator Staff Member

    29,720
    6,711
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,015
    Local Time:
    2:18 PM
    Nginx 1.13.x
    MariaDB 5.5
    you'd want to backup your mysql databases before running mysql queries - especially if you're deleting data.

    otherwise you could screw up your database and data

    if you do not know how to backup your database via mysqldump, i'd read up on that first https://dev.mysql.com/doc/refman/5.6/en/mysqldump.html and bottom of page at https://centminmod.com/mysql.html :)

    for running queries you can use mysql shell as outlined at https://dev.mysql.com/doc/refman/5.6/en/mysql.html

    enter mysql shell
    Code (Text):
    mysql yourdatabasename
    

    at mariadb or mysql shell prompt
    Code (Text):
    mariadb>> DELETE FROM xf_node_type WHERE node_type_id = 'WF_WidgetPage';
    mariadb>> exit
    

    or
    SSH command line would be
    Code (Text):
    mysql -e "DELETE FROM xf_node_type WHERE node_type_id = 'WF_WidgetPage';" yourdatabasename
    
     
    • Like Like x 1