Mafiree http://mafiree.com/blg Intensely Interested in MySQL Mon, 11 Oct 2010 13:07:22 +0000 http://wordpress.org/?v=2.6.2 en How to Start and Stop MySQL http://mafiree.com/blg/?p=155 http://mafiree.com/blg/?p=155#comments Mon, 11 Oct 2010 13:06:44 +0000 mathi http://mafiree.com/blg/?p=155 Hi Guys,

There are several ways to start and stop mysql. Let me share the things that I know.

Starting the mysql server:

           Server~Name ] # mysqld_safe –-defaults-file =  /path/to/my.cnf -–datadir = path/to/data/directory  –basedir = /path/to/base/directory –user = mysql &

Note : mysqld and mysqld_safe are not the same.

“mysqld” is the MySQL server daemon program also known as MySQL Server. While mysqld_safe adds some safety features to mysqld. It will restart the server when an error occurs and logging runtime information to an error log file. 

Stopping the mysql server:

        Server~Name ] # mysqladmin -h<IP> -u<User> -p<Password> -P<Port> shutdown

* There is a simplest way to start and stop mysql. Follow the simple steps to achieve that.

Step 1: Copy the mysql.server start up script to /etc/init.d/

        Server~Name ]# cp /mysql/base/directory/support-files/mysql.server   /etc/init.d/mysql

Note : /etc/init.d contains the various start/stop script of the system. This will start up the scripts while the system starts up.

Step 2 : Edit the /etc/init.d/mysql and provide the mysql base-directory and data-directory path

          Server~Name ]# vi /etc/init.d/mysql

               base-dir=/path/to/base/directory/

               path-dir=/path/to/data/directory/

Step 3 : Save the changes done using :wq

Now the mysql can be start and stop using the simple script as follows.

       Server~Name ] # /etc/init.d/mysql  { start|stop|restart}

]]>
http://mafiree.com/blg/?feed=rss2&p=155
How to login to a remote MySQL Db? http://mafiree.com/blg/?p=149 http://mafiree.com/blg/?p=149#comments Thu, 16 Sep 2010 07:51:22 +0000 aravinth http://mafiree.com/blg/?p=149 Consider 10.168.1.1 as your local machines IP address and 10.168.1.2 as the remote host’s IP that you intend to connect.

First thing that you need to do is to check whether port 3306 in the remote host is open.You can use telnet command to check it.

localhost$] telnet 10.168.1.2 3306

Trying 10.168.1.2…

Connected to remote6.106 (10.168.1.2).

Escape character is ‘^]’.

8

5.1.36-logJU[G1_k{BI*3`m"]0w’Z

If the port is open you would get something like above

Now login to the remote host using ssh client.

remotehost $] ssh 10.168.1.2

Then login to mysql.

remotehost $] mysql -u root -p

password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 25630

Server version: 5.1.36-log MySQL Community Server (GPL)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql>

If you want a new user to be created that you would use to login from your local server, you can create that user and then give the necessary grants as shown below.

mysql>grant all privileges on *.* to boss@’10.168.1.1′;

Query OK, 0 rows affected (0.01 sec

Now that you have created the user for remote login you can login from your local machine.

Take the below command as an example to login to remote MySQL.

localhost$] mysql -uboss -h10.168.1.2 -p

password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 25630

Server version: 5.1.36-log MySQL Community Server (GPL)

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql>

That’s it. You are now connected to the remote MySQL server.

]]>
http://mafiree.com/blg/?feed=rss2&p=149
Resetting MySQL root password http://mafiree.com/blg/?p=130 http://mafiree.com/blg/?p=130#comments Thu, 04 Feb 2010 10:54:12 +0000 shun http://mafiree.com/blg/?p=130

There are two ways to reset MySQL root password as follows:

FIRST WAY

  • Stop the server
  • Open a text file, give the below statement and save the file (for example the filename is /tmp/newpass.txt).
    • UPDATE mysql.user SET Password=PASSWORD(’YourNewPassword’) WHERE User=’root’ and host=’localhost’;
    • FLUSH PRIVILEGES;
  • Now, start the server with –init-file option
    • mysqld_safe --init-file=/tmp/newpass.txt &
  • You can login in to mysql with your new root password now.
  • Once you have logged in successfully, remember to delete the text file (/tmp/newpass.txt).

SECOND WAY

  • Stop the server
  • Start the server with –skip-grant-tables option
    • mysqld_safe --skip-grant-tables &
  • Connect the server using mysql client utility (eg: mysql). When it asks for password, just hit enter.
  • Issue the below statements.
    • UPDATE mysql.user SET Password=PASSWORD(’ YourNewPassword ‘) WHERE User=’root’ and host=’localhost’;
    • FLUSH PRIVILEGES;
  • You can login in to mysql with your new root password now.

Note:  Second way of resetting password is not secure

]]>
http://mafiree.com/blg/?feed=rss2&p=130
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysql.sock’ http://mafiree.com/blg/?p=124 http://mafiree.com/blg/?p=124#comments Wed, 03 Feb 2010 05:46:24 +0000 partha http://mafiree.com/blg/?p=124 When I tried to connect mysqld server, I got this error.

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysql.sock’

1. Check whether mysqld server is running or not, using the below command

ps -ef | grep mysql

If mysqld is running, then check the socket path in the .cnf file and give the correct path when connecting.

2. Check the file permission of that socket file. If the file doesn’t have mysql permission, just change permission to mysql using the below command.

chown mysql:mysql sockfile_path

3. If the socket file is missing then you have to restart your mysqld server.

]]>
http://mafiree.com/blg/?feed=rss2&p=124
Impossible WHERE noticed after reading const tables http://mafiree.com/blg/?p=117 http://mafiree.com/blg/?p=117#comments Mon, 01 Feb 2010 07:34:55 +0000 aravinth http://mafiree.com/blg/?p=117 I ran a explain plan in MySQL and i got

mysql> explain SELECT users.user_id FROM friends INNER JOIN users ON friends.friend_to = users.user_id WHERE friends.friend_from=108643 and friends.friend_to=108643;
+—-+————-+——-+——+—————+——+———+——+——+—————————————————–+
| id | select_type | table | type | possible_keys | key  | key_len | ref  | rows | Extra                                              |
+—-+————-+——-+——+—————+——+———+——+——+—————————————————–+
|  1 | SIMPLE      | NULL  | NULL | NULL          | NULL | NULL    | NULL | NULL | Impossible WHERE noticed after reading const tables |
+—-+————-+——-+——+—————+——+———+——+——+—————————————————–+
1 row in set (0.00 sec)

This means that there is no matching rows for the condition that was provided.

]]>
http://mafiree.com/blg/?feed=rss2&p=117
mysqld_safe The file /usr/local/mysql/bin/mysqld does not exist or is not executable. Please cd to the mysql installation directory and restart this script from there as follows: ./bin/mysqld_safe& http://mafiree.com/blg/?p=112 http://mafiree.com/blg/?p=112#comments Wed, 27 Jan 2010 09:31:35 +0000 thiyaghuck http://mafiree.com/blg/?p=112 I started MySQL server like this,

/usr/local/src/mysql-5.1.42-linux-x86_64-glibc23/bin/mysqld_safe  –datadir=/usr/local/src/mysql-5.1.42-linux-x86_64-glibc23/data –basedir=/usr/local/mysql-5.1.42-linux-x86_64-glibc23 &

I got the error shown below

mysqld_safe The file /usr/local/mysql/bin/mysqld does not exist or is not executable.

and I fixed by entering in to MySQL installed directory and started the server

cd /usr/local/src/mysql-5.1.42-linux-x86_64-glibc23

./bin/mysqld_safe  –datadir=/usr/local/src/mysql-5.1.42-linux-x86_64-glibc23/data –basedir=/usr/local/mysql-5.1.42-linux-x86_64-glibc23 &

]]>
http://mafiree.com/blg/?feed=rss2&p=112
MySQL Cluster Query Execution http://mafiree.com/blg/?p=109 http://mafiree.com/blg/?p=109#comments Fri, 20 Nov 2009 12:53:09 +0000 suresh http://mafiree.com/blg/?p=109 Hi,

MySQL Cluster executes the queries depending on the below type of scan’s it does

  1. Primary key lookup
  2. Unique key lookup
  3. Ordered index scan (i.e., non-unique indexes that use T-trees)
  4. Full table scan

Let’s say you have 4 data nodes in your cluster (NoOfReplicas=2). This means you have 2 node groups and each one has half the data. Cluster uses a hash on the primary key (unless you’ve controlled the partitioning using the 5.1 partitioning features). So for any table, half the rows are in one node group and half the rows are the in other node group.

Now for the 4 types of query execution. You can verify which type of execution is used with EXPLAIN. Here’s how each ones works:

  1. Primary key lookup - the MySQL server can calculate the hash on the primary key and know which data node the relevant row resides in. Then the MySQL server contacts that data node and receives the row.
  2. Unique key lookup - the MySQL server cannot know which data node the row might be stored in. So it contacts a pseudo-random node. That data node has a hidden table that maps the unique key values to the primary key. Then the hash on the primary key reveals where the row resides.
  3. Ordered index scans are sent in parallel to all data nodes, where they search their local t-tree.
  4. Full table scans are send in parallel to all data nodes, where they scan their primary fragment.

Summary: primary key lookups are best. If you have more than 2 nodes, throughput goes up because all nodes are actively serving different fragments of data. Ordered index lookup and full table scans are done in parallel, so more nodes leads to better performance.

Thanks,

Suresh Kuna

]]>
http://mafiree.com/blg/?feed=rss2&p=109
show procedure status or mysqldump with routines causing mysqld restart in 5.1.40 version http://mafiree.com/blg/?p=107 http://mafiree.com/blg/?p=107#comments Wed, 18 Nov 2009 11:44:14 +0000 suresh http://mafiree.com/blg/?p=107 Hi,

When we take a mysqldump with routines or show procedure status where Db=’dbname’;

The mysqld server got an error like “Lost connection to mysqld server”, when we login into server the will be running and it got restarted.

To fix this, upgrade the db by using mysql_upgrade and it got fixed for me.

Thanks,

Suresh Kuna

]]>
http://mafiree.com/blg/?feed=rss2&p=107
Lost connection to MySQL server http://mafiree.com/blg/?p=89 http://mafiree.com/blg/?p=89#comments Wed, 12 Aug 2009 12:31:41 +0000 suresh http://mafiree.com/blg/?p=89 This type of error may occur in the below scenarios.

1) It indicates network connectivity trouble. If the error message includes “during query” then we have to look at the query and the number of rows being sent.
Then try increasing “net_read_timeout” variable from its default value.
2) It can happen when the client is attempting the initial connection to the server. If your “connect_timeout” value is set to only a few seconds, you can increase the same for resolving this issue.
3) It can occur when using BLOB values that are larger than “max_allowed_packet” and may get “packet too large” as error, then increase the “max_allowed_packet” value to resolve the same.

Suresh Kuna

]]>
http://mafiree.com/blg/?feed=rss2&p=89
Error: data file /mysql/data/mysqld/ibdata1 is of a different size http://mafiree.com/blg/?p=57 http://mafiree.com/blg/?p=57#comments Wed, 12 Aug 2009 06:13:27 +0000 suresh http://mafiree.com/blg/?p=57 Hi,
If the Mysql is not starting and the error log consists of the below error after the configuration of a slave with the tar file of master.

081022 6:19:02 InnoDB: Warning: shutting down a not properly started
InnoDB: or created database!
081022 6:19:02 /usr/local/mysql4020/libexec/mysqld: Shutdown Complete

InnoDB: Error: data file /mysql/data/mysqld/ibdata1 is of a different size
InnoDB: 128000 pages (rounded down to MB)
InnoDB: than specified in the .cnf file 65536 pages!
InnoDB: Could not open or create data files.
InnoDB: If you tried to add new data files, and it failed here,
InnoDB: you should now edit innodb_data_file_path in my.cnf back
InnoDB: to what it was, and remove the new ibdata files InnoDB created
InnoDB: in this failed attempt. InnoDB only wrote those files full of
InnoDB: zeros, but did not yet use them in any way. But be careful: do not
InnoDB: remove old data files which contain your precious data!
081022 6:19:04 Can’t init databases
081022 6:19:04 Aborting

Then change the below variable as the same in the master cnf file

innodb_data_file_path =ibdata1:2000M;ibdata2:100M:autoextend
and start the mysqld server.

Suresh Kuna

]]>
http://mafiree.com/blg/?feed=rss2&p=57
?>
  • david hasselhoff gary coleman features
  • jennifer beck and john syes neveda
  • does don johnson live in la resizing
  • playboy marliece andrada pics mastercraft
  • melody thornton nude pics spartanburg
  • sarah hyland nude salsa
  • jose carreras grandchild blitz
  • bobby bell rice scouting report fill
  • terry carter corpus christie osama
  • jonathan nelson song lyrics scoop
  • ana hickmann wallpapers poulan
  • michael buble home page wolverines
  • tracy miller clay nascar
  • matthew bomer girlfriend carter
  • carlos slim helu investments videos nonprofit
  • larry wilcox ritual defamation 1990 element
  • richard benjamin blood pleated
  • andnot reynolds
  • billy connolly sound bite projections
  • keith olbermann countdown for april 14th comfort
  • does debby ryan have a boyfriend pitman
  • sean cullen live dyed
  • lyrics for hey stephen taylor swift converters
  • greeting fords
  • gerardo alejandro rodriguez junior outs
  • marta kristen lost in space refresher
  • debra winger crotch users
  • tori praver bodypaint proffesional
  • fiona fullerton photo storm
  • limousine sprung
  • karen green joliet mt claims
  • toni collette abba film quinn
  • heather mitts wallpaper pharmacies
  • mark frost seth suppression
  • charlotte jones murrel dinwiddie users
  • alan jackson precious memories cd sale delux
  • thora birch and kaplan university vacations
  • nigel john glover divorce humidity
  • where was judge judy sheindlin born plates
  • bloodhound gang boys in the hood membrane
  • tatjana patitz rising sun video supervisor
  • rhonda fleming mann jeffrey
  • jansen panettiere daily emmy idol torx
  • zoe bell pics lenses
  • charlotte gainsbourg pictures torre
  • lees patio
  • rebates sweeping
  • gonna bloomberg
  • joseph fiennes penis dedham
  • melissa satta nude pic knives
  • brian lowe louisville ky those
  • dean butler jockey rebel
  • rebecca martinez martinez skeletal
  • sexy rae dawn chong gallery rubies
  • paula prentiss photo hattiesburg
  • larry clark range rovers overhaul
  • julie adams montclair state u cabarrus
  • andrew bynum photo membership
  • jason lewis actor's age gauge
  • hector elizondo as pancho duque fixer
  • george clarke consulting carmichael
  • tom hickman murdered norton
  • sarah polley tom scholte airbags
  • ana de la reguera pic quarter
  • jason jones gets landed on dryer
  • movies matt dillon has been in mansion
  • eddy mitchell mp3 ironing
  • shilpa shetty wallpapers smokie
  • christopher walken saturday night live handrail
  • kristian alfonso gina von amberg glendale
  • emma de caunes nude photo hacking
  • connie sellecca photos menus
  • ringo starr eric clapton 2008 refurb
  • david morse dead cummins
  • does lloyd wood have school tomarrow gustafson
  • geri haliwell sex tape cavity
  • who has john travolta dated intercooler
  • michael keaton dimensions bought
  • keir dullea toni colette 1896
  • thomas jane physical training program punisher marley
  • marks chute
  • jillian grace paternity phantom
  • chris ramsey woodturner recycled
  • chris tucker comedy cafe latest
  • bobby hutcherson montara router
  • avram grant chelsea jimenez
  • juli ashton free movies ownership
  • randy roberts purdue troubleshooting
  • michael collins white working class forex
  • tracy miller feng shui interactive
  • webjal marquis
  • stephen collins biography expo
  • chuck berry thirty days jeffery
  • olympia dukakis tennessee williams snowfall
  • matt garcia sacramento police mani
  • tasha tilberg img hayward
  • robert rodriguez and machete match
  • paul schaffer songs urine
  • citi newsletters
  • piano chords janel parrish rainy day cookies
  • william ash collector spiderman
  • ignitor dorset
  • gina glocksen and joey monterrey
  • madison pettis bio tailed
  • mickey mouse michael eisner phone call monitors
  • actor chad allen on being gay yachts
  • gwyneth paltrow gloop toilet
  • nicole narain galleries applications
  • ana cristina polo in miami dunlap
  • gillian welch dscography horticulture
  • richard kline hemet controll
  • bruce greenwood residence quebec
  • michel gondry knives out remixes
  • honor blackman satues piercings
  • tovah feldshuh roles tallahassee
  • overture ratios
  • michael french mundelein high school prognosis
  • will forte payton manning toll
  • oui traci lords november 1984 1899
  • vivica fox sex video footage acrobat
  • tower of power lenny williams youtube complete
  • sprague grayden nude filtering
  • holly weber galleries peachy saints
  • eliza dushku nude tits vegtable
  • viggo mortensen elle november 2009 idea
  • samkon gado girlfriend sulfate
  • judith krantz pornography squeak
  • roger evans north carolina 30th
  • lyrics kate ryan ella elle l'a 1912
  • farley granger death input
  • angelica bridges playboy photos marlow
  • it's on scott storch mp3 injected
  • david henrie hair gaskets
  • judge joe brown court pays judgements meri
  • allison munn nudography soluble
  • sidney poitier biography diablo
  • angela basset chris rock ripper
  • sigrid thornton nude photos gifting
  • doris roberts clothes hung
  • alexis bledel mexican fairview
  • bruce willis biography age tikka
  • champ bailey pro bowl jersey sorento
  • nicolas sarkozy and america getaway
  • the kingsmen southern gospel concerts spoilers
  • stacks bernina
  • matthew montgomery gay video moters
  • priced newfoundland
  • the mississippi mass choir mp3 highway
  • william carol lawrence greensburg pa adelaide
  • dylan mcdermott bio bombings
  • fearne cotton gossip top commentators closed fireplaces
  • jennifer lauren cheated carrot
  • alan almond 100.3 mighian feeds
  • gary collins norliss bleed
  • jodie marsh page 3 cheyenne
  • movie patrick stewart detonator nigga
  • jack elam sidekicks 1941
  • naughty by nature's biggest hits amount
  • stephanie bentley i rembrandt
  • lindsay sloane nude mechanics
  • mark healy journalist authentication
  • charisma carpenter bio dana
  • stacy keach drama calie kite
  • brooke bundy and jonathan lipnicki cinemark
  • did donna douglas like the animals haircuts
  • tiffany dupont oops 1975
  • naked cerina vincent pics newsletters
  • elizabeth adams montevideo minnesota autocad
  • kristin kreuk in underwear galleries covina
  • traders pythons
  • elle macpherson sports illustrated swimsuit cover rush
  • juliet anderson porn enzo
  • hayden panettiere racy metroid
  • adrianne palicki sexy ministry
  • rachel nichols espn reporter naked hollis
  • greg plitt new video northbridge
  • marta kristen fakes expressway
  • cody johnson football assy