My Laravel box was using MySQL 5.6.41:
$ php artisan tinker
Psy Shell v0.9.9 (PHP 7.2.11 — cli) by Justin Hileman
>>> DB::connection()->getPdo()
=> PDO {#2943
inTransaction: false,
attributes: {
CASE: NATURAL,
ERRMODE: EXCEPTION,
AUTOCOMMIT: 1,
PERSISTENT: false,
DRIVER_NAME: "mysql",
SERVER_INFO: "Uptime: 71185 Threads: 1 Questions: 2555 Slow queries: 0 Opens: 103 Flush tables: 1 Open tables: 82 Queries per second avg: 0.035",
ORACLE_NULLS: NATURAL,
CLIENT_VERSION: "mysqlnd 5.0.12-dev - 20150407 - $Id: 38fea24f2847fa7519001be390c98ae0acafe387 $",
SERVER_VERSION: "5.6.41", <<<--- This is the MySQL version
STATEMENT_CLASS: [
"PDOStatement",
],
EMULATE_PREPARES: 0,
CONNECTION_STATUS: "127.0.0.1 via TCP/IP",
DEFAULT_FETCH_MODE: BOTH,
},
}
I upgraded the MySQL version to 5.7.24 using yum:
$ mysql --version
mysql Ver 14.14 Distrib 5.7.24, for Linux (x86_64) using EditLine wrapper
However, when I check the version through Laravel, it is still the same.
I've checked the .env file for variables that have a value of 5.6.41 or an absolute path to a mysql executable, but have found nothing. As such, I would assume it would just pick up the same version I do when I run which mysql. However, this is not the case.
I have also tried composer dump-autoload in case it just needed to be refreshed, but it didn't help.
This is running on an ec2 box with AWS Linux.
How can I get Laravel to use the same version of MySQL I get when I run which mysql?
Edit:
sudo service mysqld restart did not do the trick.
After talking with a colleague, it seems that what I have accomplished is updating the client, but the database itself is still not upgraded. I will update later if that turned out to be the cause of the issue.
Related
I try to migrate from MySQL 5.7 to PostgreSQL 11.6 with pgloader on Ubuntu 18.04.
pgloader -v -d mysql://mysqluser:secret#localhost/dbnamesource pgsql:///postgres:secret#localhost/dbnametarget
MySQL and PostgreSQL user exist and can login on command line. Both have GRANT rights.
The above scripts output:
sb-impl::*default-external-format* :UTF-8
tmpdir: #P"/tmp/pgloader/"
2019-12-17T08:29:55.019000Z NOTICE Starting pgloader, log system is ready.
2019-12-17T08:29:55.029000Z INFO Starting monitor
2019-12-17T08:29:55.033000Z INFO Stopping monitor
The target database is empty.
Where ist the problem or what can i do to find the problem?
yeah, there is one slash too much (after pgsql:). Now it works:
pgloader -v -d mysql://mysqluser:secret#localhost/dbnamesource pgsql://postgres:secret#localhost/dbnametarget
I've tried to go backup my MuSQL DBs, by going to : Servers / MySQL Database Server ,from Webmin interface. But, when the page loads, I only see this message :
The MySQL client program /usr/bin/mysql does not appear to be the
correct version. Webmin only supports MySQL versions 3 and above.
The command /usr/bin/mysql -V returned :
/usr/bin/mysql: unknown variable 'keybuffer=300M'
Can anyone here help me please, in regard to this matter ?
Here are my setting details :
Operating system CentOS Linux 7.3.1611
Webmin version 1.851
Usermin version 1.720
Virtualmin version 5.99
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
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.
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.