Getting error while importing mysql database - mysql

I am importing the follwoing mysql example
http://dev.mysql.com/doc/sakila/en/sakila-installation.html
when i try to import then i get this error on centos
SOURCE sakila-schema.sql;
ERROR 1548 (HY000) at line 446: Cannot load from mysql.proc. The table is probably corrupted
The seems to get imported

you should try this one and refer this link1 and link2
mysql_upgrade -u root -p
mysql_upgrade.exe -uroot -p --force

Related

import mysql data dump to Maria DB

I am trying to import mysql data dump to Maria DB with below command
mysql -u root -p --one-database new_db < data_dump.sql;
But I am getting below error
ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MariaDB server version for the right
syntax to use near 'mysql -u root -p --one-database zapcheck <
zapcheck.sql' at line 1
I tried different combinations but nothing worked. Its not even telling what's the issue.
Please let me know the issue here or is there any other way I can import?
You can try the command below to import the file:
Note: Open the terminal where dump.sql is located
After opening the terminal:
//Skip this process if you have already created a database.
Mysql> create database newdb;
// Using the new created database
Mysql> use newdb;
// Importing the dump.sql file to newdb database
Mysql> source dump.sql

MySQL ERROR 2005 on Vagrant

I am getting the following error when importing a file into MySQL on a Vagrant box
ERROR 2005 (HY000) at line 1: Unknown MySQL server host '-' (0)
I first run to extract the data
gunzip < /vagrant/app/data/bkup.sql.gz > /tmp/blu.sql
And then run the following to import
mysql -u root -proot blu < /tmp/blu.sql
This gives me the above errors related to an unknown host. I have now idea why this is occurring because the following works just fine and logs me in
mysql -u root -proot blu
The data I am importing is from a mysqldump so should be clean and not contain any errors.
Why is the host issue occurring and how can I solve it?

MYSQL importing dump completed with errors

when I try to import my exported dump file (specifically my database/schema) to other computer, I got this error;
D:\CAPSTONE SYSTEM\MyDataBaseCAPSTONE\Dump20150922\schm_capstonesystem_routines.sql does not contain schema/table information
16:58:55 Restoring schm_capstonesystem (employee_entry)
Running: mysql.exe --defaults-file="c:\users\kc\appdata\local\temp\tmpnowdu_.cnf" --protocol=tcp --host=localhost --user=root --port=3306 --default-character-set=utf8 --comments --database=schm_capstonesystem < "D:\CAPSTONE SYSTEM\MyDataBaseCAPSTONE\Dump20150922\schm_capstonesystem_employee_entry.sql"
ERROR 1049 (42000): Unknown database 'schm_capstonesystem'
Operation failed with exitcode 1
Please help~! :-(
The error is Unknown database. You have to create the database 'schm_capstonesystem' first.
And then run the import of your dump.
In case you don't know how to create the schema as in the answer above:
right Click the left pane under Schema in SQL, click create schema,enter a name for the schema (preferably the same as the db your importing) click apply. Then do the import

SQL syntax error near gunzip when restoring a database using .sql.gz file

I am trying to restore a mysql db using a .sql.gz file. I am using mySql console to run a command because file size is too large for phpMyAdmin. Command I am using is
gunzip C:/Vik/Gya/Source/beed_2013-04-06.sql.gz | mysql -u root -p bd
where root is the user id. There is no password for root. bd is the database to which I am trying to import. mysql is running on my local machine (Windows 8). I have a wamp setup.
This is the error I am getting:
ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near 'gunzip
C:/Vikalp/Gyankosh/Source/beedictionary_2013-04-06.sql | mysql -u root
-p' at line 1.
You need -c option (output to stdout)
gunzip -c xxx.sql.gz |mysql -u root -p
While Kisoft´s answer is the correct one, I just wanted to point out that you don´t need the -c, it works just fine as it is.
this command will unzip the database dump and import it into the database at the same time.
gunzip < output.sql.gz | mysql -u <username> -p<password> <database>
If you type gunzip and you get a SQL syntax error that complaints about gunzip, you are already logged into the mysql console. The mysql console is not a general purpose shell!
You are using Windows and I suspect you haven't installed gzip in your computer (it isn't a builtin utility). It's a classical Unix tool but you can find binaries for Windows. Install it and run your original command with a couple of tweaks:
Make sure you're in Windows prompt (C:\>)
Redirect gunzip result to stdout rather than a file:
gunzip --stdout C:/Vik/Gya/Source/beed_2013-04-06.sql.gz | mysql -u root -p bd
Alternatively, you can run the dump from within MySQL promt (mysql>) if you uncompress it first (you don't need specifically command-line gzip, most GUI archivers such as 7-Zip support this format):
mysql> \. C:/Vikalp/Gyankosh/Source/beedictionary_2013-04-06.sql
you do not need to gunzip
just:
zcat myfile.gz | mysql -uuser -ppassword mydatabase
it is faster this way
Your answer is already here
phpMyAdmin: Can't import huge database file, any suggestions?
Under php.ini file, normally located in c:\xampp\php or wampp whatever you called
post_max_size=128M
upload_max_filesize=128M
Changing value there will get you what you want.Good luck
Dont forget to restart , apache and mysql .
Try this following steps to restore db using .gz files:
1. Run command : gunzip C:/Vik/Gya/Source/beed_2013-04-06.sql.gz
This will uncompress the .gz file and will just store beed_2013-04-06.sql in the same location.
2. Type the following command to import sql data file:
mysql -u username -p bd < C:/Vik/Gya/Source/beed_2013-04-06.sql

MySQL database - error when backup database

When i try do database backup in Linux i got this error,
"Got error: 1296: Got error 157 'Unknown error code' from NDBCLUSTER when using LOCK TABLE"
can someone please guide me what i have to do to solve this error.
Thanks.
Execute the following from the linux shell to make a database dump (backup)
mysqldump -p -u[username] --no-lock-tables [database]>dumpfile.sql
replace [username] and [database] with the appropriate credentials of yours, like:
mysqldump -p -uroot --no-lock-tables mydb>dumpfile.sql