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.
Related
I ran sudo apt-get install mysql-client and it installed correctly. Then I ran mysql_config_editor print and I got
mysql_config_editor: not found
mysql_config_editor does not show up in /usr/bin like I expect it to, and like it does on my other machine.
On the machine where it worked, mysql --version shows
mysql Ver 8.0.21-0ubuntu0.20.04.3 for Linux on x86_64 ((Ubuntu))
On the machine where it doesn't work, mysql --version shows
mysql Ver 15.1 Distrib 10.1.45-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
How can I install a version of mysql that comes with mysql_config_editor or install the mysql_config_editor utility itself?
On MariaDB, as we have not a utility like mysql_config_editor to create ~/.login.cnf with obfuscated passwords, neither MariaDB reads it, one could degrade to ~/.my.cnf file with plain text:
[client]
user=my_username
password=my_password
#port=mysql_port
#socket=my_socket
#database=my_default_dbname
And then change access modes:
chmod 600 ~/.my.conf
Now only you can read this plain text file.
This avoids you to type user and password on command line on debian os in an insecure way, readeable by ps command.
mysql
Ref. https://mariadb.com/kb/en/configuring-mariadb-with-option-files/
Unfortunately MariaDB does not support this feature as explained here : https://mariadb.com/kb/en/mysql_config_editor-compatibility/
MariaDB is a fork of MySQL. So you can use its client to connect to a MySQL DB but it lacks the mysql_config_editor option.
Installing a MySQL client with mysql_config_editor is covered here : https://askubuntu.com/a/708606/943405
But I strongly advice you to uninstall the MariaDB client before and reinstall the full MySQL client to avoid troubles.
If you can't uninstall the MariaDB client then your solution is the best.
I'm a little frustrated at this point, so I had to come for aid to stackoverflow lol I've been stuck trying to setup the dev environment for 3h...
This is what's happening, the new version of mysql doesn't support compatible client-side authentication mechanisms for the new server plugin.
More info here
So at this point I had MySQL installed with version 8.0 and I'm trying to revert it back to 5.7 because none of my node.js projects work locally.
Now, I followed this to uninstall MySQL completely.
and this to install multi version with the difference of instead of writing mysql56 I wrote mysql#5.7 because homebrew/versions/ is deprecated.
So... once I do that I go to the terminal and check:
sudo mysql -v
and I get this:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
That is if I remove the current agent (the new version 8.0), if I add it back:
# Start agent for current version of mysql (including on login)
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
then it would show me this:
The older version which is the one I want is already linked:
brew link --force mysql#5.7
now... here is the funny thing, when I type: mysql --version
it says: mysql Ver 14.14 Distrib 5.7.23, for osx10.13 (x86_64) using EditLine wrapper
And when I go to my node.js env. to run a query or something, it says:
Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
which is the problem mentioned on the other posts about MySQL versioning.
Can someone lend me a hand please. Thanks guys
Brew was suppoused to give me a nice and quick way to install that version, but I ended up even forgeting what I was developing to troubleshoot MySQL... So I decided to go to the oracle page and download it from there. I made a guide, in case another person has the same problem, to read it go here.
If someone has time and wants to have some fun with brew let me know what's the fix for that :)
I have taken over a production Linux RHEL server which has a MySQL install on it. I need to find out which version of MySql is installed.
Apparently this is easy information to determine which it says here on mysql.com but unfortunately no one can remember the root password and no one knows what version of MySQL it is.
I am assuming it is Enterprise but I need to know for sure.
I tried 2 different commands:
mysql --version
Output:
mysql Ver 14.14 Distrib 5.6.13, for Linux (x86_64) using EditLine wrapper
and
file /usr/sbin/mysqld
Output:
/usr/sbin/mysqld: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
Both of these commands provided me with useful information but I still need to figure out if the server has the Community or Enterprise edition.
No , you can't. You need to login to mysql to get this info.
Can use commands like,
SHOW VARIABLES LIKE "%version%";
You can get the details using status command in the mysql command prompt. Don't use the windows cmd prompt to execute the command.
mysql > Status
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.
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?