Showing posts with label MySql. Show all posts
Showing posts with label MySql. Show all posts

Tuesday, May 5, 2026

How to import and export database(sql query) in MYSQL

>Open MY sql server

 >Click on Server Menu

>Click on Data Import

> Click on Import from self-contained file

> Click on 3 dot and than select sql file

>Select Default Target Schema(Dropdown) and  select blank database name

> Click on Start Import button

Thursday, April 23, 2026

Error in importing database in drupal - Missing expression. (near "ON" at position 25) - XAMPP - set foreign_key_checks on error

Missing expression. (near "ON" at position 25)

MYSQL

SET FOREIGN_KEY_CHECKS = ON;



Solution:-
Change max_allowed_packet=1 to max_allowed_packet=1024M in MY.ini
in PHP.ini add these four lines
 max_execution_time = 600
max_input_time = 600
memory_limit = 1024M
post_max_size = 1024M
upload_max_filesize=1024M

Also please check below link:-

Wednesday, April 8, 2026

How to install drupal - How to run a website made in drupal

 Add this line in settings.php

$config['system.image']['toolkit'] = 'gd';

uncomment this line(for showing error log )

$config['system.logging']['error_level'] = 'verbose'; 

Customize below code

$databases['default']['default'] = array (

  'database' => 'rni_web',              //write data base that is blank, for new installation

  'username' => 'root',

  'password' => '',

  'prefix' => '',

  'host' => 'localhost',

  'port' => '3307',

  'namespace' => 'Drupal\\mysql\\Driver\\Database\\mysql',

  'driver' => 'mysql',

  'autoload' => 'core/modules/mysql/src/Driver/Database/mysql/',

);


1) write data base that is blank, for new installation ( 'database' => 'rni_web',  )

2) after next , you will get errors  of gd than see below link

https://kapooryash.blogspot.com/2026/04/error-while-starting-my-sql-or-appache.html

3) if drupal new install than use it with that database, if website already modified or given by some other person than change database name with backup database(replace  ( 'database' => 'rni_web',  ) with other database)

Thursday, April 2, 2026

Error while starting My sql or Appache in Xampp server

 https://webolute.com/blog/programming/this-may-be-due-to-a-blocked-port-missing-dependencies/


and for My sql, use below steps

Open the XAMPP Control Panel and click Config next to MySQL, then select my.ini.

Find the lines port=3306 (usually in two places) and change them to port=3307.


next step

If going to localhost:8000 get error than change the config.inc.php, enter the password in string $cfg['Servers'][$i]['password'] = 'root';

and change

$cfg['Servers'][$i]['controluser'] = 'pma'; to  $cfg['Servers'][$i]['controluser'] = 'root';

$cfg['Servers'][$i]['controlpass'] = '';$cfg['Servers'][$i]['controluser'] = 'root';


=========================================
C:/xampp/php/php.ini
C:/xampp/apache/conf/httpd.conf
C:/xampp/mysql/bin/my.ini
C:/xampp/phpMyAdmin/config.inc.php
These above 4 files are changed.

C:/xampp/phpMyAdmin/config.inc.php
/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'root';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';

/* Bind to the localhost ipv4 address and tcp */
$cfg['Servers'][$i]['host'] = '127.0.0.1:3306';
$cfg['Servers'][$i]['connect_type'] = 'tcp';

/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = 'root';

and for xampp server- default password is blank
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';

/* Bind to the localhost ipv4 address and tcp */
$cfg['Servers'][$i]['host'] = '127.0.0.1:3307';
$cfg['Servers'][$i]['connect_type'] = 'tcp';

/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = '';
 
=======================
C:/xampp/mysql/bin/my.ini - How to change the port of Mysql in xampp
port=3306
socket="C:/xampp/mysql/mysql.sock"

# Here follows entries for some specific programs 

# The MySQL server
default-character-set=utf8mb4
[mysqld]
port=3306
socket="C:/xampp/mysql/mysql.sock"
basedir="C:/xampp/mysql"

C:/xampp/apache/conf/httpd.conf(How to change port of Appache server in xampp) 
For changing https port
Listen 80 -- change here
ServerName localhost:80

C:/xampp/php/php.ini
if getting error "plugin does not exist. Valid plugin IDs for Drupal\Core\ImageToolkit\ImageToolkitManager are: gd in Drupal\Core\Plugin\DefaultPluginManager-"
1) Press Ctrl + F and search for ;extension=gd.
2) Remove the semicolon (;) at the beginning of the line so it looks like this: extension=gd.
3) restart xaamp server
and
Add or uncomment the following line in your php.ini file: zend_extension=opcache.
Verify Settings: Ensure opcache.enable=1 is set in your php.ini.

c:\xampp\apache\conf\extra\httpd-ssl.conf
SSL port 4443

c:\xampp\apache\conf\extra\httpd-xampp.conf
if appache is not running than change this file.

c:\xampp\mysql\bin\my.ini
port=3307

C:\xampp\htdocs\PRGIWebsitedrupal\sites\default\settings.php
$config['system.image']['toolkit'] = 'gd';

For more drupal settings, please see link below.

Note:- In settings.php file port can be 3306 of Mysql workbench client and In My.ini port can be different(3307) because appache server my sql is different and mysql workbench is different.

Tuesday, March 3, 2026

How to add multiple records with insert query in MYSQL

   INSERT INTO new_registration

(

`Ownership_Category`,

`Is_Govt_Org`,

`Title_Category`,

`Nationality`,

`Owner_Name`,

`Owner_Pan_Card`,

`Upload_pan_card_Document`,

`Mobile_No`,

`Email_ID`,

`PinCode`,

`State`,

`District`,

`City`,

How to add multiple rows in MySQL with for loop with stored procedure

 -- 1. Change the statement delimiter

DELIMITER $$

DROP PROCEDURE IF EXISTS insert_data_loop;

-- 2. Create the stored procedure

CREATE PROCEDURE insert_data_loop()

BEGIN

    DECLARE i INT DEFAULT 1; -- Declare a variable for the loop counter

    DECLARE max_value INT DEFAULT 50; -- Set the loop limit


    -- Start the WHILE loop

    WHILE i <= max_value DO

        -- 3. The INSERT query inside the loop

         SET i = i + 1;

        INSERT INTO new_registration

(

`Ownership_Category`,

`Is_Govt_Org`,

`Title_Category`,

`Nationality`,

`Owner_Name`,

`Owner_Pan_Card`,

`Upload_pan_card_Document`,

`Mobile_No`,

`Email_ID`,

`PinCode`,

`State`,

`District`,

`City`,

`Address`,

`DOB`,

`Upload_DOB_Certificate`,

`GST_No`,

`Upload_GST_Certificate`)

VALUES

(

'Individual',

1,

'News Paper',

'Indian',

'Yash Kapoor','45YYH87Y','Documents/test1.jpg',

457851,'test@test.com',

110022,'Haryana',

'Sonepat','Sonepat','Jangpura, Delhi',

' 15/01/1945', 'Documents/test1.jpg' ,

'JHJDFHJDF8787DF',

'Documents/test1.jpg');

        

        -- Increment the counter

       

    END WHILE;

END $$


-- 4. Reset the delimiter

DELIMITER ;


-- 5. Call the procedure to run the insert loop

CALL insert_data_loop();


-- Optional: verify the results

SELECT * FROM new_registration;


Note:- You cannot use for loop without Creating stored procedure.


How to add auto increment in column in MySQL

 https://stackoverflow.com/questions/33602936/mysql-workbench-auto-increment-disabled

How to add auto date in column in MySQL

 NOW() 

 CURRENT_DATE

CURRENT_TIMESTAMP 


in Default/Expression Column

Insert query in MYSQL - with now() - with update date

  INSERT INTO `test`.`new_registration`

(

`Ownership_Category`,

`Is_Govt_Org`,

`Title_Category`,

`Nationality`,

`Owner_Name`,

`Owner_Pan_Card`,

`Upload_pan_card_Document`,

`Mobile_No`,

`Email_ID`,

`PinCode`,

`State`,

`District`,

`City`,

`Address`,

`DOB`,

`Upload_DOB_Certificate`,

`GST_No`,

`Upload_GST_Certificate`)

VALUES

(

'Individual',

1,

'News Paper',

'Indian',

'Yash Kapoor','45YYH87Y','Documents/test1.jpg',

457851,'test@test.com',

110022,'Haryana',

'Sonepat','Sonepat','Jangpura, Delhi',

' 15/01/1945', 'Documents/test1.jpg' ,

'JHJDFHJDF8787DF',

'Documents/test1.jpg');



Monday, March 2, 2026

How to generate Create Query in MYSQL

 Right Click on Table(New_Reg_Table) 

>Click on Send to SQl Editor

> Click on Create Statement

Wednesday, October 1, 2025

How to create stored procedure in MySql and how to call stored procedure

 DELIMITER $$

CREATE PROCEDURE new_procedure_procedure_name()

BEGIN

    SELECT * 

    FROM test.new_table t1

    LEFT JOIN test1.table1 t2 ON t1.id = t2.id;

END $$

DELIMITER ;


===============================

CALL new_procedure_procedure_name();

How to create new database in MYSql

 > First open My SQL workbench

>Than click on Database menu and click on Connect to database

> Than in navigator , Select Schemes tabs

> Right click in navigator and click on Create schema 

> and Type name and click on apply and click on apply and click on finish

How to connect MySql and how to install MySql

> First download MySql Workbench

> Than click on Database menu and click on Connect to database.

> Than click on OK button

> Than click on Schemas  tab.

> Than write query 

For Creating database

Create Schema test or Create Database test;


Monday, August 7, 2023

MYSQL insert update and delete in asp.net c# - with connection string

   private string conString = @"server=localhost;database=stamppaper;port=3306;username=root;password=;SslMode=none";


private void BindGrid()

        {

            using (MySqlConnection con = new MySqlConnection(conString))

            {

                using (MySqlCommand cmd = new MySqlCommand("SELECT * FROM Stamp", con))

                {

                    cmd.CommandType = CommandType.Text;

                    using (MySqlDataAdapter sda = new MySqlDataAdapter(cmd))

                    {

                        using (DataTable dt = new DataTable())

                        {

                            sda.Fill(dt);

                            grdStamp.DataSource = dt;


                            grdStamp.Columns[0].HeaderCell.Value = "Sr. No.";