The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

mysql 5.5 search and replace deprecated syntax

Discussion in 'Database Discussions' started by dfoxx, Jul 5, 2013.

  1. dfoxx

    dfoxx Member

    Joined:
    Feb 1, 2010
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    Could someone please post the command to search all files in all /home/*/public_html folders
    for TYPE=MyISAM so that it gets replaced with ENGINE=MyISAM because TYPE=MyISAM is deprecated.

    Could there be a script developed so that all deprecated functions are replaced by the correct syntax ?

    Best Regards,
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    This command may be helpful:

    Code:
    grep -H -r "TYPE=MyISAM" /home/
    This would output all files in /home that use "TYPE=MyISAM" within the file contents.

    Thank you.
     
  3. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,146
    Likes Received:
    34
    Trophy Points:
    48
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Also you can use the following command for this

     
  4. dfoxx

    dfoxx Member

    Joined:
    Feb 1, 2010
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    What is the difference between the two commands ?
    Are the commands capital letter sensitive ?

    Is it also possible to automatically change TYPE=MyISAM" to ENGINE=MyISAM" ?
     
    #4 dfoxx, Jul 16, 2013
    Last edited: Jul 16, 2013
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    You can review the differences between the various flags used with "grep" by running the following command:

    Code:
    man grep
    Both commands provided are case sensitive. You can add the "-i" flag so it will include all matches:

    Code:
    grep -H -r -i "TYPE=MyISAM" /home/
    I do not recommend automatically replacing the entry in every file because you risk incorrectly modifying the files if you are not comfortable on the command line. However, you could develop a custom "replace" command if necessary.

    Thank you.
     
  6. STS Admin

    STS Admin Well-Known Member

    Joined:
    Jul 8, 2012
    Messages:
    47
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    India
    cPanel Access Level:
    Root Administrator
    You can use "find" and "sed" command to replace text in files

     
Loading...

Share This Page