MySQL replace all whitespaces with dash
[code lang=”php”]UPDATE `articles` SET `slug` = REPLACE( `slug`, ‘ ‘, ‘-‘ )[/code]
[code lang=”php”]UPDATE `articles` SET `slug` = REPLACE( `slug`, ‘ ‘, ‘-‘ )[/code]
[code lang=”php”]UPDATE `song_copy` SET `song_path_new` = substring(`song_path_new`, instr(`song_path_new`, ‘/’) + 1)[/code] From: AAA/BBB/CCC TO: BBB/CCC
1. rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY* 2. rpm –import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt 3. cd /tmp 4. wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm 5. rpm -ivh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm 6. rpm –import https://fedoraproject.org/static/0608B895.txt 7. wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm 8. rpm -ivh epel-release-6-8.noarch.rpm 9. yum update 10. yum install pure-ftpd 11. cd /etc/pure-ftpd/ 12. vi pure-ftpd.conf UnixAuthentication yes VerboseLog yes PureDB /etc/pure-ftpd/pureftpd.pdb CreateHomeDie yes 13. pure-pw useradd mywebsite -u…
[code lang=”php”]UPDATE my_table SET my_col = SUBSTRING_INDEX(my_col, ‘/’, 1)[/code] From: AAA/BBB/CCC To: AAA
[code lang=”php”]UPDATE `table` SET `column` = SUBSTRING_INDEX(`column`,’/’,-1);[/code] From: AAA/BBB/CCC To: CCC
Install VSFTPD and setup user 1. Type this [code leg=”php”]# cd /tmp[/code] 2. Install VSFTPD [code leg=”php”]# yum install vsftp[/code] 3. Open vsftpd configuration file – /etc/vsftpd/vsftpd.conf [code leg=”php”]# vi /etc/vsftpd/vsftpd.conf[/code] 4. Make sure following line exists (and uncommented) [code leg=”php”]chroot_local_user=YES[/code] 5. Add user to FTP [code leg=”php”]# adduser -c ‘FTP USER Tom’ -m tom…
MySQL combine two columns and add into new column [code language=”sql”] UPDATE tablename SET combined = CONCAT(zipcode, ‘ – ‘, city, ‘, ‘, state) [/code] Output: zipcode – city, state MySQL combine two columns and add into new column where year is a number [code language=”sql”] UPDATE `tablename` SET cat_path = CONCAT(year, ‘/’, name) WHERE…
Copy one column from one table to another table column – MySql. [code language=”sql”] UPDATE `table` , `table_2` SET table_2.HQ_ID = table.HQ_ID WHERE table_2.name = table.name [/code]
Duplicate id into other column in MySQL. [code language=”sql”] UPDATE contest_cat SET pid = id [/code]