Blog Archives

Magento: Remove best seller products from admin dashboard

Use the below MySQL queries:

TRUNCATE `sales_bestsellers_aggregated_daily`;
TRUNCATE `sales_bestsellers_aggregated_monthly`;
TRUNCATE `sales_bestsellers_aggregated_yearly`;

MySQL: Query to get the MySQL database size in MB

table_schema "Database Name", 
SUM(data_length+index_length)/1024/1024 "Database Size in MB", 
SUM(data_free)/1024/1024 "Free Space in MB" 
FROM information_schema.TABLES 
GROUP BY table_schema;

The total number of locks exceeds the lock table size

This issue can be resolved by setting the higher values for the MySQL variable “innodb_buffer_pool_size”. The default value for innodb_buffer_pool_size will be 8,388,608.

To change the settings value for “innodb_buffer_pool_size” please see the below set.

1) Locate the file my.cnf from the server. For Linus servers this will be mostly at /etc/my.cnf
2) Add the line “innodb_buffer_pool_size=64MB” to this file
3) Restart the MySQL server

To restart the MySQL server, you can use anyone of the below 2 options:

1) service mysqld restart
2) /etc/init.d/mysqld restart

ACT the database could not be accessed

Receiving the error:

The database could not be accessed. In order to access this database, check your networkconnection and verify that your database server is available. It may be necessary to disable andy firewall software on you computer or the server.

The 2 most likely causes on a standalone are a damaged or invalid .pad file or SQL is not running, or is damaged.

.PAD file

  • Close ACT!
  • Click your Windows Start button, choose Run and type in actdiag
  • When ACT! Diagnostics comes up, click Databases, the Database List
  • Locate your database in the list, right-click on it and select Detach. Make sure you know the filepath to your database before detaching it.
  • When the database has been detached, open My Computer (or Windows Explorer) and browse to the location of your database.
  • Locate the .PAD file for your database [database name].pad and delete it
  • Reopen ACT!…you will get a message that the last database opened cannot found, then will be taken to the Open Database dialog box
  • At the bottom of this box, change the Files of Type to .adf, browse to the location of your database and double-click on the .adf file for your database
  • You will get a message that ACT! will verify your database, click OK and ACT! will reattach your database to SQL and create a new .pad file
SQL Server
  • Close ACT!
  • Click on your Windows Start button, select run, and type in services.msc
  • When the list of Local Services comes up, scroll down and locate the service called SQL Server (ACT7)
  • Look in the Status column and make sure it says Started…if not, then right-click on the service and select Start

Act Error: The Database Could Not Be Accessed

Shell: mysqldump with only the table structure and no data

mysqldump -h localhost -u root -p --no-data --compact database_name > database_name.sql

Backuping a single table using mysqldump

Backuping a single table from a database
mysqldump -u USERNAME -p DATABASE_NAME TABLE_NAME > /path/to/folder/file_name.sql

MySql: query result in csv file using command

Form the mysql prompt use the below command:

SELECT * FROM table_name
INTO OUTFILE '/tmp/table_name.csv'

MSSQL: logs/ overwritten — Unclean shutdown of previous Apache run

1. Stop all WAMP services and the SQL Server (Express) service

2. Get ntwdblib.dll version 2000.80.194.0 ( OR get a free copy of ntwdblib.dll by downloading MS SQL Server 2000 SP4 from Microsoft Website. It contains a copy of ntwdblib.dll version 2000.80.194.0 in the system directory). Copy and replace any other versions of this file to the following locations:

  • Your PHP binaries folder (ie C:\wamp\bin\php\php5.2.6)
  • Your Apache binaries folder (ie C:\wamp\bin\apache\apache2.2.8\bin)
  • Windows\System32\

3. Configure SQL Server to accept TCP connections and Named Pipes through the SQL server configuration manager (yes you will need the client tools installed).

4. Configure SQL Server for Mixed mode authentication and remember the password you set for sa

5. Start the SQL Server Service

6. Edit your php.ini and set the

mssql.secure_connection = On

7. Make sure your wamp folder has proper access rights (full control for ‘everyone’).

8. Start all services from the WAMP menu.

MySQL: query result to file using console

Given a query like below to log the results to a text file

select id from accounts where deleted=1;

try using the command below to output the result to file to ‘C:\test.txt’

select id from accounts where deleted=1 into outfile 'C:\\test.txt';

try using the command below to output the reuslt to csv

select id from accounts where deleted=1 INTO OUTFILE 'C:\\test.csv'

mysql: ERRIR 3 : Error writing file ‘C:\WINDOWS\TEMP\MYD62.tmp’ 13631488

For me this was due to the temp folder was stored at a FAT32 drive. Changes the temp directory to NTFS drive and the problem solved.

On my.ini file change the variable tmpdir or create one using tmpdir = Your\path

Related Articles


Get every new post delivered to your Inbox.

Join 268 other followers

%d bloggers like this: