How to Check MySQL Server Version in Laravel?
Teams applying “How to Check MySQL Server Version in Laravel?” in a production project can use this practical overview to record implementation, review and debugging time, then compare that effort with tests and shipped functionality instead of treating activity as performance by itself.
Before copying the example into a live application, confirm version-specific behaviour with the official Laravel website and test it against the project’s actual database and runtime.
Hello Friends,
Today, I will let you know example of how to check mysql server version in laravel. I’m going to show you about how to check which database is used in laravel. This article will give you simple example of how do i check my current version of laravel. This post will give you simple example of how to get mysql version..
In this post, I will share with you how to get the MySQL Version using Laravel. Lately, I need to determine what MySQL version I'm using and maybe you need it also.
Step 1: Install Laravel
This is optional; however, if you have not created the laravel app, then you may go ahead and execute the below command:
composer create-project laravel/laravel example-app
App/Http/Controllers/HomeController
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class HomeController extends Controller
{
/**
* Write Your Code..
*
* @return string
*/
public function index()
{
$sqlVersion = \DB::select( \DB::raw('SHOW VARIABLES LIKE "%version%"') );
print_r($sqlVersion);die;
}
}
Output
Array
(
[0] => stdClass Object
(
[Variable_name] => in_predicate_conversion_threshold
[Value] => 1000
)
[1] => stdClass Object
(
[Variable_name] => innodb_version
[Value] => 10.4.21
)
[2] => stdClass Object
(
[Variable_name] => protocol_version
[Value] => 10
)
[3] => stdClass Object
(
[Variable_name] => slave_type_conversions
[Value] =>
)
[4] => stdClass Object
(
[Variable_name] => system_versioning_alter_history
[Value] => ERROR
)
[5] => stdClass Object
(
[Variable_name] => system_versioning_asof
[Value] => DEFAULT
)
[6] => stdClass Object
(
[Variable_name] => tls_version
[Value] => TLSv1.1,TLSv1.2,TLSv1.3
)
[7] => stdClass Object
(
[Variable_name] => version
[Value] => 10.4.21-MariaDB
)
[8] => stdClass Object
(
[Variable_name] => version_comment
[Value] => mariadb.org binary distribution
)
[9] => stdClass Object
(
[Variable_name] => version_compile_machine
[Value] => x64
)
[10] => stdClass Object
(
[Variable_name] => version_compile_os
[Value] => Win64
)
[11] => stdClass Object
(
[Variable_name] => version_malloc_library
[Value] => system
)
[12] => stdClass Object
(
[Variable_name] => version_source_revision
[Value] => 4902b0fdc91cc6dc169dd2322daf966a2eeafdd8
)
[13] => stdClass Object
(
[Variable_name] => version_ssl_library
[Value] => WolfSSL 4.8.0
)
)
- How to Notifications With database Driver in Laravel 11?
- How to Send Email Via Notification in Laravel 11?
- How to Install and Configure Laravel 11 Debugbar?
- How to Like Dislike System in Laravel 11?
- How to Paginate a Model with Relationship in Laravel 11?
- Laravel 11 Upload Files to Amazon S3 Example
- Laravel 11 Send WhatsApp Messages Example
- Laravel 11 Rest API Authentication Using JWT Tutorial