Mysql Database restore - mysql

We have existing bugzilla 3.6 running in in Debian OS and now I installed new bugzilla server 4.4.4 on REDHAT
On Debian the MySQL version is Ver 14.12 Distrib 5.0.51a,
On Redhat the MySQL Version is Ver 14.14 Distrib 5.1.61,
I tried to import existing MySQL database to new mysql database like below
mysql -u bugs -p bugs < /root/backup-02-23-2015-19-00.sql
once import is finished.
I tried to create new bug but it giving error like below
Software error:
DBD::mysql::db selectcol_arrayref failed: Unknown column 'id' in 'field list' [for Statement "SELECT id FROM bug_see_also WHERE bug_id = ?"] at Bugzilla/Bug.pm line 3497
Bugzilla::Bug::see_also('Bugzilla::Bug=HASH(0x2f794f0)') called at Bugzilla/Bug.pm line 963
Bugzilla::Bug::update('Bugzilla::Bug=HASH(0x2b00398)', '2015-02-26 11:36:43') called at /var/www/html/bugzilla/post_bug.cgi line 198
For help, please send mail to the webmaster (root#localhost), giving this error message and the time and date of the error.
Please help me

How did you export the database? (Show the mysqldump command used if possible).
Perhaps your sqldump contains only the schema, and not the data.

We are exporting like below
mysqldump -u admin --all-databases > to-file

Perhaps bugzilla 3.6 and 4.4.4 have significantly different db schemas, in which case a dump from one will not be compatible with the other.
Perhaps if you installed 3.6 on the new one, and loaded your database, it would work.
Then, you could upgrade from 3.6 -> 4.4.4, and hopefully the upgrader is smart enough to manipulate your db along the way.

Related

MySQL Workbench 8.0.28 export issue on MacOS 12.3 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 11 months ago.
Improve this question
Up until recently I was using MySQL Workbench 8.0.20 without any issues till I upgraded my MacOS to 12.3 after which the Workbench software itself stopped working. I then upgraded my Workbench version to 8.0.28 (latest version at the time of writing).
But after updating to the new version, I initially had issues connecting to my remote databases. I was getting the following error -
Got error: 2026: SSL connection error: error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol when trying to connect
But I was able to solve that one by setting the 'Use SSL' option under the SSL tab for the connection to 'No'.
The next issue though is now I am not able to perform exports on the server using mysqldump. The Workbench software is trying to run the following command -
Running: /Applications/MySQLWorkbench.app/Contents/MacOS/mysqldump --defaults-file="/var/folders/fd/jt76prtj4z35dqd6y1y1_jcw0000gn/T/tmppuwxrtig/extraparams.cnf" --host=host.db.com --port=3306 --default-character-set=utf8 --user=logicspice --protocol=tcp --single-transaction=TRUE --column-statistics=0 --skip-triggers "database"
after which I'm getting a similar issue -
mysqldump: Got error: 2026: SSL connection error: error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol when trying to connect
Is there an update I can do to a certain configuration file for either mysqldump or MySQL Workbench that will disable the use of SSL when trying to use mysqldump?
Your assistance would be much appreciated as this issue is causing delays in my development work. Thanks!
Summary of system -
Operating system - MacOS Monterey 12.3
Processor - 2.4 GHz 8-Core Intel Core i9
MySQL Workbench version - mysql-workbench-community-8.0.28-macos-x86_64.dmg
MySQL version - 5.6.10 (MySQL Community Server (GPL)) on AWS RDS
Exporting a MySQL or MariaDB database
To export the database, the mysqldump command is used from the console. Once the backup is done, the generated file can be easily moved. To start exporting the database you have to execute the following:
mysqldump -u username -p database_name > data-dump.sql
username : Refers to the name of the database user.
database_name : Must be replaced by the name of the database you want to export.
data-dump.sql : Is the file that will be generated with all the database information.
That command will not produce any visual output. So, to make sure that the SQL copy has been performed correctly, you can inspect the generated file to make sure that it is a SQL copy. To do this you can use the following statement:
head -n 5 data-dump.sql
That command should return something like this:
-- MySQL dump 10.13 Distrib 5.7.16, for Linux (x86_64)
--
-- Host: localhost Database: database_name
-- ------------------------------------------------------
-- Server version 5.7.16-0 ubuntu 0.16.04.1
It is also possible to export one or more tables instead of the entire database. To do this, you must indicate in the command the selection you want to make.
mysqldump -u username -p database_name table_name_1 table_name_2 table_name_3 > data-dump.sql
In this case, it is important to take special care with the relationships between the different records. When importing, only those tables that have been selected will be overwritten.
Importing a MySQL or MariaDB database
To import a MySQL or MariaDB dump, the first thing to do is to create the database into which the import will be done. To do this, if you do not have any database manager, you have to connect to the database server as "root" user.
mysql -u root –p
This will open the MySQL or MariaDB shell. You will then be able to create the database.
mysql> CREATE DATABASE new_database;
If everything went well, you will see something like this:
Query OK, 1 row affected (0.00 sec)
Once created, you have to exit this shell by pressing CTRL+D. Once you are in the normal command line, it will be time to launch the command that will perform the database import.
mysql -u username -p new_database < data-dump.sql
username : Is the name of the user with access to the database.
new_database : Is the name of the database where the import will be performed.
data-dump.sql : Is the name of the file containing all the sql statements to be imported.
If any errors occur during the import process, they will be displayed on the screen. As you can see, exporting and importing a MySQL or MariaDB database is a very simple process.
Note : All this is done with Ubuntu in a terminal but in MAC it is exactly the same .
Another solution : In case you still get that error I have found assuming you are using OpenSSL and not ysSSL.
Refer to the MySQL configuration variable ssl_cipher. ssl_cipher
Configure a list of ciphers including pseudo-encryption #SECLEVEL=1
For example :
ssl_cipher = "DHE-RSA-AES128-GCM-SHA256:AES128-SHA:#SECLEVEL=1"
If you need a more permissive but still secure encryption list.
"EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH:ECDHE-RSA-AES128-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA128:DHE-RSA-AES128-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES128-GCM-SHA128:ECDHE-RSA-AES128-SHA384:ECDHE-RSA-AES128-SHA128:ECDHE-RSA-AES128-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA128:DHE-RSA-AES128-SHA128:DHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA384:AES128-GCM-SHA128:AES128-SHA128:AES128-SHA128:AES128-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4:#SECLEVEL=1"
taken from https://cipherlist.eu/ could do the job.

data export error mysql workbench 6.3

I want to export the whole database using workbench. I keep getting the following error message. I used server>data export option in workbench.
This is a known bug in MySQL Workbench 6.3.5. Your options are to either (A) wait for an upcoming Workbench version to fix it, or (B) change your mysqldump binary (under User Preferences) to a different non-bundled mysqldump binary, likely one from MySQL Server 5.6.
You can easily dump the whole database from the command line:
mysqldump -u <db_username> -p -h <db_host> db_name > database_dump.sql

Alternative ways to store data base into a file

What can I use instead of mysqldump to extract information from db to any file?
I need to give back my computer and save information from it. Buy when I tried to save data base I had I faced a problem:
$mysqldump5 x -u root > x.150124.sql
mysqldump: Couldn't execute 'SET OPTION SQL_QUOTE_SHOW_CREATE=1': 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 'OPTION SQL_QUOTE_SHOW_CREATE=1' at line 1 (1064)
In internet people face such a problem because they have new mysql and old mysql dump. And they recommend to install mysql56. My versions looks similar:
$ mysqldump5 --version
mysqldump Ver 10.13 Distrib 5.1.66, for apple-darwin11.4.2 (i386)
$ mysql5 --version
mysql5 Ver 14.14 Distrib 5.1.66, for apple-darwin11.4.2 (i386) using readline 6.2
but nevertheless I tried to install mysql56 using MacPorts (similarly to my previous mysql installation) and failed to do it because of errors py27-setuptools stage. All this problems looks quite complicated to solve and it is not guarantied that new problems wouldn't appear and I need the result quickly.
So I ask if there any other ways to store DB information. I don't really care about "clean solutions" and state of the system afterwards, since it will be reinstalled in any-case.
How about
select ... into ... outfile
here is more info on it...http://dev.mysql.com/doc/refman/5.1/en/select-into.html
edit: even better link http://www.mysqlfaqs.net/mysql-faqs/Data-Back-Up/Export-Data/How-to-use-SELECT-INTO-OUTFILE-statement-to-export-data
The quickest way, which I found is to stop current server:
mysqladmin5 shutdown
and install mysql5.6.22 from dmg package (mysql community server for osx10.9), avoiding mac ports.
After that
/usr/local/mysql-5.6.22-osx10.8-x86_64/bin/mysqldump -u root x > ~/x.150125.sql
did the job.
P.S. I don't accept this answer because it doesn't provide alternative solution for dumping. Therefore I accepted #Jose Martinez despite I didn't used that solution.

MySQL error 2006 MySQL server has gone away after upgrade to 5.6.10 using homebrew on Max OS X 10.8.3

I upgraded my installation of MySQL on my Mac OS X 10.8.3 using homebrew
brew install mysql
Everything seemed to go smoothly, but...not really, as it turns out.
I cannot add a new user (neither through the command line nor through phpmyadmin. I always get the error
Error in processing request: #2006 MySQL server has gone away
I can create new databases without a problem, and I can install, for example Joomla 3.1.1 with no problems.
However, when I try to install a new extension into my Joomla installation, I get errors. For example, I get the following error when I try to install a component from NoNumber:
1062 Duplicate entry '1' for key 'PRIMARY' SQL=INSERT INTO `u5z87_extensions` (`name`,`type`,`element`,`folder`,`client_id`,`enabled`,`access`) VALUES ('plg_system_nnframework','plugin','nnframework','system','0','1','1')
Same thing for many other extensions.
I tried to start mysql with
mysql.server start --log-warnings=2
and it started with no problem
Starting MySQL
SUCCESS!
I looked up issues where error #2006 were being reported and how to solve them, and they referred to modifying /etc/my.cnf but there is no /etc/my.cnf configuration file on my system, and there wasn't one in the previous installation of MySQL 5.5.29 (also installed with homebrew) and I had no problems.
I ran brew doctor and the output is below
$ brew doctor
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.
Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:
/usr/local/opt/php54/bin/php-config
The output from brew --config is also below:
$ brew --config
HOMEBREW_VERSION: 0.9.4
ORIGIN: https://github.com/mxcl/homebrew
HEAD: 86ce842c700a47abdc354e80cc3b0b3938ab2132
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit nehalem
OS X: 10.8.3-x86_64
Xcode: 4.6.2
CLT: 4.6.0.0.1.1365549073
LLVM-GCC: build 2336
Clang: 4.2 build 425
X11: 2.7.4 => /opt/X11
System Ruby: 1.8.7-358
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /Users/alisamii/.rvm/rubies/ruby-1.9.3-p374/bin/ruby
Exploring a little further, I tried to revert to my previous install of MySQL using
brew switch mysql 5.5.29
This resulted in the following output:
$ brew switch mysql 5.5.29
Cleaning /usr/local/Cellar/mysql/5.5.29
Cleaning /usr/local/Cellar/mysql/5.6.10
135 links created for /usr/local/Cellar/mysql/5.5.29
I then accessed mysql from the command line and ran status:
mysql> status
--------------
mysql Ver 14.14 Distrib 5.5.29, for osx10.8 (i386) using readline 5.1
Connection id: 13
Current database:
Current user: alisamii#localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.6.10 Source distribution
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /tmp/mysql.sock
Uptime: 1 hour 56 min 24 sec
As you can see above, it reports mysql Ver 14.14 Distrib 5.5.29, for osx10.8 (i386) using readline 5.1
But, it also says Server version: 5.6.10 Source distribution
So something isn't syncing up.
Furthermore, when I show databases, I get the following output:
mysql> show databases
-> ;
+--------------------+
| Database |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.00 sec)
But I know I have more than just an information_schema database.
So, somehow, it seems to me that mysql is not connecting to the right server, as phpmyadmin reports the same server information that mysql's status command reports: Software version: 5.6.10 - Source distribution.
At this point, I am completely lost, and would really need some help.
OK, so partially resolved the issue.
At the recommendation of https://stackoverflow.com/users/201789/tehshrike I read the pages related to mysql_update and followed the recommendations there.
Upgrading MySQL does not upgrade the information_schema, and so some things don't work. This command helps fix some of those issues.
Now, I can add new users and the #2006 - MySQL server has gone away error is no longer an issue.
However, I am still getting the #1062 errors when trying to install extensions in Joomla, for example. Still exploring solutions to that. Will update this answer with details when solved.

Can't Connect to Local Mysql from terminal

NOTE: The full discussion to the answer in this question is in a chat link in the comment section below, above the submitted answers.
The summarized answer is in checked answer.
After meddling with installing the gem for mysql2 and successfully doing that I type
which mysql
and it returns
mysql: aliased to nocorrect mysql
I'm not sure what this means.
Then I type in
mysql --version
and it outputs
mysql Ver 14.14 Distrib 5.5.20, for osx10.7 (i386) using readline 5.1
So I know mysql is installed.
Finally I want to configure a database for my rails app so, from within the correct directory I type:
mysql -u root -p
It asks me for a password and, since there is none, I leave it blank. It outputs this:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
I've been reading around for a solution but I don't understand any of them. Like finding a file called my.cnf or a folder called etc within the rails framework files...
It's trying to connect over unix sockets instead of tcp/ip. Try adding -h param eg
mysql -h localhost -u root -p
edit: Just read your question a bit closer. "mysql" being installed just means you have a client, not the server itself. Check you have mysqld installed.
mysql --socket=/var/lib/mysql/mysql.sock -u root -p
also read this
Here is what finally allowed me to create a freaking database in my rails apps through terminal after dealing this error.
I downloaded mysql's .dmg 64 bit version from here:
http://dev.mysql.com/downloads/mysql/
and then I followed the instructions in the README file. That was the most important part.
Thanks for the help everyone.
EDIT:
This didn't answer the question entirely for me since mysql stopped working.
After installing .dmg version I had to update the bash_profile file.
Here is where the instructions are:
Should I reinstall Mysql?