RSS

Tag Archives: MySql

Fast Installation of Percona RPM

Often we find it difficult to Install MySql RPM Files One by One which takes a lot of time and Lookups for each command,   here’s the Easiest way to Remove Existing Percona Packages and Install them in 2 steps.  Ifound it easy and time saving.

Here’s the below command to find Existing Percona Packages on the Server.

# rpm -qa | grep Percona-Server

 

To Remove Percona Packages without Dependencies

# rpm -qa | grep Percona | xargs rpm –nodeps -ev

use this for removing MySql packages

 rpm -qa | grep -i MySql | xargs rpm –nodeps -ev

 

To Install all RPM files with Dependencies use the below command. (Note: Please cd the directory where percona Packages are Installed and then run the Command from the Shell Script)

rpm -ivh *.*

 

Hope This Helps..

 

 
Leave a comment

Posted by on September 10, 2012 in Database Administration

 

Tags: , , ,

Win Free MySQL Conference Tickets!

Percona is giving Away  three full conference passes (worth $995 each) to the Percona Live MySQL Conference and Expo, and you can win one simply by sharing the conference with your friends and colleagues! Second prize is one of ten copies of the newHigh Performance MySQL, 3rd Edition (worth $55 each), the recently released update to the popular second edition!

Please click the below link on how to win these Prizes …

Percona Free Prizes

Thanks & Have a Great Day.

 
Leave a comment

Posted by on March 15, 2012 in Database Administration

 

Tags: , , , , , ,

Commonly used daily Linux Commands.

1) How to Replace a big string with WildCard Characters.  just dump the string in between the hash (#) and  it does the job.  use /g at the end to replace strings everywhere.

%s#/this/folder/replaces/#/with/this/one/#g

2) Search for a word and delete to the end of the line.  for ex: in an XML file  sometimes you need to delete 1000’s of lines matching a word or a <string> spread across the XML file,  you can’t simply replace some lines like below ex.. in MS-WORD or any other editors,   from the below ex: only delete those which starts with <pcode> until the end of the line and preseve the “\>”. use the below simple command to do the job.

<xml=? >
<scalar variable   <pcode  value=1000  test1 test3 test4> />
<vector variable   <pcode  value=1001  test5 test6 test7> />
<stellar value       <pcode  value=1002  test8 test9 test10> />
</xml>

%s/\<pcode\>.*/\/>/

3)  How to find Un-wanted files, if you’r clean folder has been messed up.  I had this situation where some of the junk files has been added to my MySql Data direcotory where i see only the Database Tables which are useful and i used the below command to find all the files excluding MySql Database Tables.

grep ./ --exclude=*.{ibd,MYD,MYI,frm} *

4)  CHOP the file to 1gb from a 9.5GB file : i had this big file which is 9.5gb Data MySql Log file for my analysis purposes, however my script takes too long time to read this file and i had no choice to chop this file to 1GB and read the data from this 1GB file which makes it easier for MySql to read faster.  I used the below command.

 dd if=10gbfilename of=1gb_new_filename bs=100M count=10

5)  How to get extract 100 lines of data from a file which has 10,000 lines.
sed -n 1,100p test1.log > outputfile.log
6) How to find which raid your Linux software has..

for i in /dev/md*; do printf ‘%s: %s\n’ $i “$( sudo /sbin/mdadm –detail $i 2>/dev/null | grep ‘Raid Level’ )”; done

7) Convert files to Unix &  UTF8 format.

Convert to UTF8 format

/usr/bin/iconv -c -f LATIN1 -t UTF8 insert_statements_postgres1.sql > utf8_postgres_inserts.sql

/usr/bin/iconv -c -f LATIN1 -t UTF8 delete_statements_post1.sql > utf8_postgres_deletes.sql

Convert Bulk files to utf8 format: (csv files)

for file in *.csv; do
/usr/bin/iconv -c -f LATIN1 -t UTF8 “$file” -o “${file%.csv}.csv”
done

 
 

Tags: , , , , , ,

Replication enhancements in MySql 5.5

Recently we upgraded all our databases from MySql 5.1 to 5.5 Version and we see Couple of good enhancements done on the Replication side, couple of them i noticed are.

1) Ignore any DDL commands if they doesn’t comply with master : For ex: in a  Master-Master Setup environment

Master1 (MySql 5.1 Version)  – Slave of Master2
Master2 (MySql 5.1 Version)  – Slave of Master 1
Replica 1 (Mysql 5.5 Version)
Replica 2 (MySql 5.5 Version)

i)  we had 2 temporary tables created on Master and replicated to all the slaves where slaves are upgraded to Mysql 5.5 and Both Masters running MySql 5.1 version (bad scenario),
ii) I deleted 2 temporary tables with set Sql_log_bin=0  on master1 (not Master 2)
iii) I ran the same script on all Replication Slaves separately and Deleted temp tables.
iv) i forgot to set SQL_LOG_BIN=0 on Master2 and executed the script.  Master1  slave stopped with an error “unable to locate temp tables 1 and 2. but on Replication Slaves never been stopped or had any errors.  MySql 5.5 Version simply ignored those commands when tables doesn’t exist.

This is great enhancement.

Read the rest of this entry »

 

Tags: , , , , , , , , , ,

MySql (what i know as of Today)

1) Downloaded and installed mySql on my Local Machine.

Host: Localhost
Username: ODBC
Password:  nothing

2) Installed MySqlQuery Browser, MySqlAdministrator from Mysql Website

3) Connected to MySql Server Using the Below Parameters

i) use the Command prompt and goto  c:/Program files/mysql/mysqlserver 5.4/bin/mysql.exe
ii) To Connect to a Database   “Use Databasename”  ex: Use Text;
iii) To see a list of tables in mySql just type  “SHOW TABLES;”
iv) To See Records in a table type “Select * from test;” will display all records.
v)for help with the mysql  type “help” and press enter at the mysql prompt

General SQL Topic

RE: What is the difference between view and materializ…


view – store the SQL statement in the database and let you use it as a table. Everytime you access the view the SQL statement executes.

materialized view – stores the results of the SQL in table form in the database. SQL statement only executes once and after that everytime you run the query the stored result set is used. Pros include quick query results.

 
Leave a comment

Posted by on July 15, 2009 in Database Administration

 

Tags: ,

 
%d bloggers like this: