Category: MySQL

SQL substring replacement

Naveen Nayak May 14, 2018 No Comments MySQL, Tips and Tricks

There are times when you need to replace only a part of the string in the database column. You can use the stuff() function in MSSQL or insert() function in MySQL MSSQL Definition: STUFF ( string , start , length , replaceWith ) Example: select stuff(‘My Original String’, 4, 8, ‘Replaced’); Output: My Replaced String […]

Increasing File Descriptors and Open Files Limit CentOS 7

Naveen Nayak September 17, 2015 4 Comments Linux, MySQL , ,

PS: See Andy Dyrcz answer in the comments for a better way to do this Some programs like Apache and MySQL require a higher number of file descriptors. This is how you can increase that limit for all users in CentOS 7 Commands require root access # Find the default limit – check the open files […]

Clear Screen for MySQL Command Prompt – Linux

Naveen Nayak June 18, 2014 No Comments MySQL, Tips and Tricks ,

On Linux, if you have logged into mysql on the command prompt  and want to clear all text on screen you can use mysql> \! clear \! system-command is the command format \! tells mysql to pass the command to the system Example [naveen@localhost ~]$ mysql -u root -p Enter password: Welcome to the MySQL monitor. […]

MySQL convert to utf8

Naveen Nayak July 31, 2013 No Comments MySQL

A quick way to convert your database to utf8 # Dump the old database as latin1, mysqldump defaults to utf8 mysqldump -h host -u user -p –default-character-set=latin1 old_db > dump.sql # Rewrite the dump to say ‘utf8’ and ‘utf8_general_ci’ sed -e ‘s/SET NAMES latin1/SET NAMES utf8/g’ -i dump.sql sed -e ‘s/DEFAULT CHARACTER SET latin1/DEFAULT CHARACTER […]

Page 1 of 2