Showing posts with label phpmyadmin. Show all posts
Showing posts with label phpmyadmin. Show all posts

Wednesday, February 16, 2022

import database by php code

 Here I explain you how to import database by PHP code.


<?php
// Name of the data file
$filename = 'u6357583.zip';
// MySQL host
$mysqlHost = 'localhost';
// MySQL username
$mysqlUser = 'root';
// MySQL password
$mysqlPassword = '';
// Database name
$mysqlDatabase = 'u635758';
// Connect to MySQL server
$link = mysqli_connect($mysqlHost, $mysqlUser, $mysqlPassword, $mysqlDatabase) or die('Error connecting to MySQL Database: ' . mysqli_error());

$tempLine = '';
// Read in the full file
$lines = file($filename);
// Loop through each line
foreach ($lines as $line) {
    // Skip it if it's a comment
    if (substr($line, 0, 2) == '--' || $line == '')
        continue;
    // Add this line to the current segment
    $tempLine .= $line;
    // If its semicolon at the end, so that is the end of one query
    if (substr(trim($line), -1, 1) == ';')  {
        // Perform the query
        mysqli_query($link, $tempLine) or print("Error in " . $tempLine .":". mysqli_error());
        // Reset temp variable to empty
        $tempLine = '';
    }
}
 echo "Tables imported successfully";
?>


Wednesday, July 3, 2019

alternate of phpmyadmin

Today I gave you alternate of phpmyadmin. Simply copy paste this file to your host and you will get all database details just like phpmyadmin.

Download from this path or copy paste this code :-


Friday, May 5, 2017

magento admin display 404 error

Hello

I transferred a website to another server. Copied all files and imported database. Frontside is working fine but admin side is not opening. It display 404 error. I re-upload database, cleared catch and sessions. But nothing happen. After i google it. Tried to many solutions. And last one query solved my problem.
Here is the solution.
Go to your phpmyadmin and run this query.

SET FOREIGN_KEY_CHECKS=0;
UPDATE `core_store` SET store_id = 0 WHERE code='admin';
UPDATE `core_store_group` SET group_id = 0 WHERE name='Default';
UPDATE `core_website` SET website_id = 0 WHERE code='admin';
UPDATE `customer_group` SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGED IN';
SET FOREIGN_KEY_CHECKS=1;

I saw that this is happen in shared server.

Wednesday, February 8, 2017

How to Increase file import size limit in phpMyAdmin

Hello. I face problem while uploading files because of its size. The default file import/upload size in phpMyAdmin is 2MB, For increasing file import size You need to make some changes in php.ini file and restart apache server. After changing following parameter you’ll able to import big .sql file easily.
Here i am going to take example of ubantu LAMP server , find php.ini file and open it on any text editor.
sudo vim /etc/php5/apache2/php.ini
 

if you are using any other server like WAMP, XAMPP similar find php.ini and open it on text editor
Find and Change these values in php.ini file.
post_max_size = 1024M 
upload_max_filesize = 1024M 
max_execution_time = 5000 
max_input_time = 5000 
memory_limit = 1024M
 
Note: don’t forget to allocate larger value to memory_limit then post_max_size.
Finally restart apache server and your new upload size will be visible on phpMyAdmin file import section, You you can upload larger file.
sudo service apache2 restart
 

 

 

Monday, January 30, 2017

How to recover phpmyadmin password

Assuming Xampp

You want to edit this file:

"\xampp\phpMyAdmin\config.inc.php"

change this line:$cfg['Servers'][$i]['password'] = 'WhateverPassword';

to whatever your password is. If you don't remember your password, then run this command in the Shell:

mysqladmin.exe -u root password WhateverPassword

where 'WhateverPassword' is your new password.

OR

There is a batch file called resetroot.bat located in the xammp folders 'C:\xampp\mysql'(works even if U are on mysql) run this and it will delete the phpadmin passwords. Then all you need to do is start the MySQL service in xampp and click the admin button.