<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
    <channel>
    <title>MySqlPlaza.com</title>
    <link>http://mysqlplaza.com/blog/</link>
    <description></description>
    <language>en-us</language>           
    <generator>Nucleus CMS v3.51</generator>
    <copyright>&#169;</copyright>             
    <category>Weblog</category>
    <docs>http://backend.userland.com/rss</docs>
    <image>
        <url>http://mysqlplaza.com/blog//nucleus/nucleus2.gif</url>
        <title>MySqlPlaza.com</title>
        <link>http://mysqlplaza.com/blog/</link>
    </image>
    <item>
    <title>MySql Performance Tunning Class</title>
    <link>xml-rss2.php?itemid=28</link>
    <description><![CDATA[MySql download: <a href="http://www.mysql.com/downloads/mysql/">http://www.mysql.com/downloads/mysql/</a><br />
Clean / Remove current MySql instalation: yum remove mysql<br />
Un-tar the mysql tar.gz: tar -xzf Desktop/mysql-5.1.53-linux-i686-glibc23.tar.gz<br />
Create a simbolic link to the instalation dir: ln -s mysql-5.1.53-linux-i686-glibc23 mysql<br />
cd mysql<br />
scripts/mysql_install_db<br />
<br />
show index from <TABLENAME>\G<br />
mysqlslap -uusername -p -a -i 10 --concurrency=1,4,16,64,256<br />
show processlist;<br />
<br />
Infobright Enterprise Edition (column level compression - open source)<br />
<br />
<b>Index prefix</b>: indexing only a subset of a filed (let's say the first 4 characthers) to save on index size and improve performance.<br />
<br />
Explaining a query with a sub-query will execute the subquery.<br />
<br />
show status;<br />
flash status;<br />
<br />
Daily Notes:<br />
http://bit.ly/OUAttendance<br />
O'Reilly MySql High Performance (2nd Eddition)<br />
QAN: Query Analyzer<br />
Benchmarking Tool: mysqlslap]]></description>
    <category>General</category>
    <comments>xml-rss2.php?itemid=28</comments>
    <pubDate>Tue, 7 Dec 2010 10:25:01 -0800</pubDate>
</item><item>
    <title>MySql Class - Instalation &amp; Replication (last day)</title>
    <link>xml-rss2.php?itemid=4</link>
    <description><![CDATA[Create 2 databases, my1 and my2, my1 will be the master and will replicate to my2.<br />
<br />
Install my5.1 into c:\my51<br />
In windoes, set the env variable for the new MySql instance.<br />
<br />
<b>Create my1:</b><br />
<br />
mkdir c:/data1<br />
mkdir c:/log1<br />
create c:/my1.cnt<br />
<br />
In notepad add to c:/my1.cnt: <br />
&nbsp;&nbsp;&nbsp;[mysql]<br />
&nbsp;&nbsp;&nbsp;datadir=c:/data1<br />
&nbsp;&nbsp;&nbsp;basedir=c:/my51<br />
&nbsp;&nbsp;&nbsp;port=5011<br />
&nbsp;&nbsp;&nbsp;log-bin=c:/log1/inst1<br />
&nbsp;&nbsp;&nbsp;#unique id for each instance in replication topology<br />
&nbsp;&nbsp;&nbsp;server-id=1<br />
<br />
navigate to the my51/bin dir and type: mysqld --defaults-file=c:\my1.cnf --skip-grant-tables<br />
Connect to the instanse (another commandline window): mysql -P 5011 (notice the upper case P)<br />
Create the MySql db: create database mysql; <br />
Navigate to the MySql db: use mysql;<br />
Run sys scripts: <br />
&nbsp;&nbsp;&nbsp;source c:\my51\share\mysql_system_tables.sql  <br />
&nbsp;&nbsp;&nbsp;source c:\my51\share\mysql_system_tables_data.sql  <br />
&nbsp;&nbsp;&nbsp;source c:\my51\share\fill_help_tables.sql (if help files/data/info is needed)<br />
<br />
To shutdown the instanse, exit out of the instanse into the OS: mysqladmin shutdown -P 5011<br />
navigate to the my51/bin dir and type: mysqld --defaults-file=c:\my1.cnf<br />
Connect to the instanse (another commandline window): mysql -P 5011 -u root (notice the upper case P and -u for the root user)<br />
<br />
Create a replication user on the master:<br />
&nbsp;&nbsp;&nbsp;create user repl@localhost identified by 'repl';<br />
&nbsp;&nbsp;&nbsp;grant replication slave on *.* to repl@localhost;<br />
<br />
<b>Create my2:</b><br />
<br />
mkdir c:/data2<br />
mkdir c:/log2<br />
create c:/my2.cnt<br />
<br />
In notepad add to c:/my2.cnt: <br />
&nbsp;&nbsp;&nbsp;[mysql]<br />
&nbsp;&nbsp;&nbsp;datadir=c:/data2<br />
&nbsp;&nbsp;&nbsp;basedir=c:/my51<br />
&nbsp;&nbsp;&nbsp;port=5022<br />
&nbsp;&nbsp;&nbsp;log-bin=c:/log2/inst2 (set if you want to replicate my3 from my2 vs replicating from master my1)<br />
&nbsp;&nbsp;&nbsp;log_slave_update=on (set if you want to replicate my3 from my2 vs replicating from master my1)<br />
&nbsp;&nbsp;&nbsp;#unique id for each instance in replication topology<br />
&nbsp;&nbsp;&nbsp;server-id=2<br />
<br />
navigate to the my51/bin dir and type: mysqld --defaults-file=c:\my2.cnf --skip-grant-tables<br />
Connect to the instanse (another commandline window): mysql -P 5022 (notice the upper case P)<br />
Create the MySql db: create database mysql; <br />
Navigate to the MySql db: use mysql;<br />
Run sys scripts: <br />
&nbsp;&nbsp;&nbsp;source c:\my51\share\mysql_system_tables.sql  <br />
&nbsp;&nbsp;&nbsp;source c:\my51\share\mysql_system_tables_data.sql  <br />
&nbsp;&nbsp;&nbsp;source c:\my51\share\fill_help_tables.sql (if help files/data/info is needed)<br />
<br />
To shutdown the instanse, exit out of the instanse into the OS: mysqladmin shutdown -P 5022<br />
navigate to the my51/bin dir and type: mysqld --defaults-file=c:\my2.cnf<br />
Connect to the instanse (another commandline window): mysql -P 5022 -u root (notice the upper case P and -u for the root user)<br />
<br />
Prep the slave for the master:<br />
run: show master status on the master to see what logile to use and at what possition on the log file to start replicate.<br />
change master to master_host = 'localhost', master_user='repl', master_password='repl', master_port=5011, master_log_file='inst1.000002', master_log_pos=329;<br />
start slave;<br />
show slave status\G<br />
<br />
<a href="http://www.mysqlplaza.com/files/MySqlClassInstructorNotes.txt">MySql Class Instructur Notes (MySqlClassInstructorNotes.txt)</a><br />
<a href="http://www.mysqlplaza.com/files/mysql-noinstall-5.1.51-win32.zip">MySql 5.1 Installation (mysql-noinstall-5.1.51-win32.zip)</a>]]></description>
    <category>General</category>
    <comments>xml-rss2.php?itemid=4</comments>
    <pubDate>Fri, 8 Oct 2010 09:10:42 -0700</pubDate>
</item><item>
    <title>MySql Class</title>
    <link>xml-rss2.php?itemid=2</link>
    <description><![CDATA[Share Drive: \\10.12.152.156\Share\<br />
<br />
InoDB = only one tablespase.<br />
<br />
*.err logs are in the same directory as the data/database/tables.<br />
<br />
connect to mysql: mysql -u root -p<br />
<br />
show databases; - each database is just a directory.<br />
show full tables;<br />
<br />
to go into a database: use <db_name><br />
<br />
*.frm - data dictionary for the table. (every table must have one, "show table" simply does an ls on the directory)<br />
*.MYD - data file for MyIsam engine.<br />
*.MYI - Indexes for MyIsam engine.<br />
<br />
Dropping these 3 files effectivly drops the table.<br />
<br />
Database called "information_schema" holds metadata/dicrionary.<br />
"mysql" database is also a data dictionary.<br />
<br />
To migrate or copy tables you simply need to copy and paste the *.frm, *.MYD, *.MYI, same for the DB with a directory.<br />
<br />
Percona - Oracle compatitors for MySql support.<br />
MariaDB - Monty's thing....Monty Program AB.<br />
Drizzle - Complete fork, stripped down MySql 6.0.<br />
<br />
DO NOT USE:<br />
MySql Migration Toolkit.<br />
MySql Administrator.<br />
MySql Query Prowser.<br />
<br />
Do use:<br />
MySql Workbench. (free)<br />
PHPAdmin.<br />
<br />
MySql Proxy - Can direct different type of queries to diferent type of slaves, can be used as a simple load balancer. <br />
<br />
Create a database from file:<br />
create database world;<br />
use world<br />
source c:\world.sql<br />
<br />
Single row vertical select: select * from my_table \G<br />
<br />
mysqld --help --verbose<br />
<br />
mysql -e "select * from dual"<br />
<br />
mysql --batch -e "select * from world.city" (will remove the borders and such from the query result on the client)<br />
mysql --xml -e "select * from world.city" (will output an XML structured data)<br />
<br />
set global <name of variable> = <value> (changes a dynamic variable value)<br />
<br />
"set session" is also available. (set sesson always overwrite set global)<br />
<br />
set global general_log = on (logs everything before parsing)<br />
<br />
show global status - show global statistics for a the instance for performance reasons.<br />
<br />
show create table <table_name><br />
<br />
----------------------------------------------------------------------------------------------------------<br />
<br />
show create table <table_name>; - will show the create statment for a table.<br />
<br />
spesify the number of records expected to be in a table to increase performance.<br />
<br />
select @@sql_mode;<br />
select @@autocommit;<br />
<br />
set sql_mode = '';<br />
<br />
status; - will show info on the current connection db.<br />
<br />
show table status like '<table_name>'\G<br />
<br />
Max_data_length: 281474976710655<br />
<br />
alter table <table_name> max_rows = 4000;<br />
<br />
explain <statment>\G<br />
explain partitions <statment>\G<br />
<br />
show engines;<br />
<br />
start transaction;<br />
update...<br />
delete...<br />
insert....<br />
commit; / rollback;<br />
<br />
show create view <view_name>;<br />
A text of the view is save in an *.frm file.<br />
<br />
show full processlist;<br />
<br />
mk-table-checksum - a good tool to compare tables b/t database / replication.<br />
<br />
After a crash, queries that uses indexes may return wrong results, to verify, run the query with no indexes, and/or do a checksum with the slave table.<br />
<br />
NO_WRITE_TO_BINLOG - prevent the statment to get in to the logs and replicate to the slaves.<br />
<br />
event = dmbs_job<br />
]]></description>
    <category>General</category>
    <comments>xml-rss2.php?itemid=2</comments>
    <pubDate>Thu, 7 Oct 2010 19:29:00 -0700</pubDate>
</item>
  </channel>
</rss>