Archive for the ‘MySQL’ Category

 

Delete file ‘mysql-bin.0000xx’

Tuesday, May 1st, 2012

mysql-bin.0000xx are binary log files. The binary log is a set of files that contain information about data modifications made by the MySQL server. The log consists of a set of binary log files, plus an index file.

To remove these files use purge command

PURGE BINARY LOGS TO 'mysql-bin.010'; -- delete all files created before here specified file
PURGE BINARY LOGS BEFORE '2008-04-02 22:46:26'; -- delete all files created before date and time specified here

mysql database backup – multiple database in seperate files

Friday, March 2nd, 2012
reference: http://www.snowfrog.net/2005/11/16/backup-multiple-databases-into-separate-files/

#!/bin/bash
# sonia 16-nov-05
# backup each mysql db into a different file, rather than one big file
# as with --all-databases - will make restores easier

USER="root"
PASSWORD="secret"
OUTPUTDIR="/var/lib/bacula"
MYSQLDUMP="/usr/bin/mysqldump"
MYSQL="/usr/bin/mysql"

# clean up any old backups - save space
rm "$OUTPUTDIR/*gz" > /dev/null 2>&1

# get a list of databases
databases=`$MYSQL --user=$USER --password=$PASSWORD \
 -e "SHOW DATABASES;" | tr -d "| " | grep -v Database`

# dump each database in turn
for db in $databases; do
    echo $db
    $MYSQLDUMP --force --opt --user=$USER --password=$PASSWORD \
    --databases $db | gzip > "$OUTPUTDIR/$db.gz"
done

Recover MySQL root Password

Wednesday, December 7th, 2011

to recover MySQL database server password use following five easy steps

Step # 1: Stop the MySQL server process.

Step # 2: Start the MySQL (mysqld) server/daemon process with the –skip-grant-tables option so that it will not prompt for password.

Step # 3: Connect to mysql server as the root user without password.

Step # 4: Setup new mysql root account password i.e. reset mysql password.

Step # 5: Exit and restart the MySQL server.

Here are commands you need to type for each step (login as the root user):

Step # 1 : Stop mysql service

# /etc/init.d/mysql stop

Step # 2: Start to MySQL server w/o password:

# mysqld_safe --skip-grant-tables &

or

# mysqld --skip-grant-tables

Step # 3: Connect to mysql server using mysql client:

# mysql -u root

Step # 4: Setup new MySQL root user password

mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit

Step # 5: Stop MySQL Server:

# /etc/init.d/mysql stop

Step # 6: Start MySQL server and test it

# /etc/init.d/mysql start
# mysql -u root -p

Magento Tables required to Import Products.

Monday, December 21st, 2009

Data inserted in following tables while importing products.

1)adminnotification_inbox
2)catalogindex_eav
3)catalogindex_price
4)cataloginventory_stock_item
5)cataloginventory_stock_status
6)catalogsearch_fulltext
7)catalog_category_product
8)catalog_category_product_index
9)catalog_product_enabled_index
10)catalog_product_entity
11)catalog_product_entity_datetime
12)catalog_product_entity_decimal
13)catalog_product_entity_int
14)catalog_product_entity_media_gallery
15)catalog_product_entity_media_gallery_value
16)catalog_product_entity_text
17)catalog_product_entity_varchar
18)catalog_product_link
19)catalog_product_link_attribute_int
20)catalog_product_website
21)core_url_rewrite

Regard

Manoj Ninave

Software Engineer,
COG IT Solutions Pvt. Ltd.
www.cogitsolutions.com
n.manoj@cogitsolutions.com

SQL_CALC_FOUND_ROWS or two queries

Friday, October 2nd, 2009

While reading few posts I found that SQL_CALC_FOUND_ROWS is faster than two queries. But a very good discussion found at http://www.mysqlperformanceblog.com/2007/08/28/to-sql_calc_found_rows-or-not-to-sql_calc_found_rows/comment-page-1/#comment-661064. check this out

One member posted following on above blog which is worth to read

Please visit the mysql official documentation here http://dev.mysql.com/doc/refman/5.1/en/information-functions.html

Please have a look at FOUND_ROWS() function. They have mentioned that it is much faster to use the query with sql_calc_found_rows rather than using a query again. And I don’t find any reason not to trust them.

Resetting a forgotten MySQL root password

Wednesday, March 18th, 2009
  1. Stop mysqld and restart it with the --skip-grant-tables option.
  2. to start use # /usr/bin/mysqld_safe --skip-grant-tables
  3. Connect to the mysqld server with this command:(you may have to use new shell / window for this)
    shell> mysql
  4. Issue the following statements in the mysql client. Replace the password with the password that you want to use.
    mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass')
        ->                   WHERE User='root';
    mysql> FLUSH PRIVILEGES;
  5. stop mysqld server using service mysqld stop - make sure to stop and restart so that new service will be password protected
  6. restart server with service mysqld start
Site map | Blog
Copyright © 2008, COG IT Solutions Pvt. Ltd. All Rights Reserved
XHTML Validated