Why do all my procedures run when I import mysqldump file? - mysql

I execute the following statement from the cmd terminal to import my MySQL Database:
mysql u- root p- database < "C:\Users\Tom\data.sql"
When I open my MySQL Database from the MySQL Workbench I've realised that more tables have been created that I don't recognise. Basically, what is happening is the stored procedures/routines I have created seem to be automatically running and thus creating many more tables? I don't want this, I'd rather execute routines as I wish using the "Call" statements in MySQL, is there a way stop this happening?

Related

Getting error when use dumped database in Navicat

I have multiple heavy databases (+3M records) and about +40 functions, procedures, and events.
I want to get a backup before doing the process on the database. backup is successfully done but when I want to use it in a new and transparent database Navicat says finished with errors.
here :
the new database has the same Character set and same collection.
but when I use the command line to get back up mysqldump dbname > bak.sql and import it with MySQL new_dbname < bak.sql finished successfully BUT without function and procedures.
how can I fix it? Thanks.

CentOS MySQL Batch run SQL

This may have been answered elsewhere, but I can't seem to locate it, so please accept my sincere apologies if this is a duplicate question.
Complete newbie to CentOS command line operation of MySQL.
I'm trying to migrate 200,000,000 + records from a MSSQL database to MySQL and the Workbench migration tool fails. Given up trying to sort that so I've written a migration package in VB.Net to get all of the other 7-800 tables migrated directly, and they work great, but I have a few very large tables with around 15,000,000 records or more in each and my migration method would take several days to complete!
So - brainwave... I have the migration program create "insert into..." SQL statements in a single sql file, ftp this to my CentOS box and execute it locally on the CentOS machine.
Works fine, using:
mysql --user=user --password=password
to log in to MySQL, then executing the script as
source mysqlscript.sql
...but I will have a lot of scripts, such as
script1.sql
script2.sql
script3.sql
...
script27.sql
Is there a way within MySQL to batch process all these SQL scripts so I can just leave it running without having to manually set each of the 27 scripts off manually?

Facing issue in importing a large SQL dump

I have a SQL file with 22 MB(The Magento table - "index_event") , when i'm trying to import it to the MySQL database using MySQLWorkBench , WorkBench is not responding and hence i'm not able to import it.
Have tried to split the statements manually but few of the insert statements are very large and is hard to split as they were single statements.
Can anyone please suggest on how to tackle this situation?
Open a terminal and connect MySQL using below command.
mysql -u youruser -p
Now select your database in which you want to import schema and data.
use your_db_name;
Now Provide you sql file using below command.
source /home/user/yourdb.sql;

When I try to log into MySQL via command line, keeps saying "unknown database 'magento2'"

When I try to log into MySQL via command line, keeps saying "unknown database 'magento2'"
Any ideas why? Tried as my username and root, getting the same message. If I can't log into mysql, how could I create a database to begin with of that name? So confused.
You should separate between your database application and a logical database. MySQL server is your database application / server.
When you're logging on to MySQL, you're choosing which logical database you would like to work with. A logical database is actually a container of objects such as tables, triggers, views, etc.
So when you see the error unknown database X, it's because you installed the MySQL server, but didn't create the logical database.
To see a list of all logical databases in your server, login to MySQL and run the command show databases;
To create your database, run the command create database magento2;
Now when you login to that database, it should be there and you can start creating your tables and query data from them.
I had the same issue and found that the database name was set in a cnf file. Perhaps you have something similar.

Import Database to MySQL via WAMP server

I use SQL Server Management Studio to manage a database I've created, 'COMPANY', and am now attempting to write some PHP code to query the database.
However, I first need to have the database in MySQL before I can attempt to connect to it. I've downloaded WAMP server and have a .sql file containing a script for re-creating my database.
I'm unable to import my database into MySQL, though. I've tried
mysql> source /pathname/company.sql
But every time I execute the command, something flashes in the MySQL console window and then the window closes. Other times I get Error 22: File not found
How can I successfully execute my SQL file?
First create the db and
Try
mysql -u root -p dbName< '/pathname/company.sql'