Posts

Showing posts with the label MySQL

MySQL Database Backup Using CLI

 Backup MySQL using terminal mysqldump -u [user name] –p [password] [options] [database_name]  > [dumpfilename.sql] mysqldump -v -u appuser–p  mydb > mydbbackup.sql

MySQL 8 User creation and grant privileges

Environment MySQL Version: 8.0.21 OS: CentOS 7 Minimal install 64bit MySQL User MySQL user can be created using by the following command in MySQL console CREATE USER 'user1'@'localhost' IDENTIFIED BY 'password1'; If the application connects to MySQL service from a specific IP address application server IP address can be specified in create user statement. CREATE USER 'user1'@'192.168.1.1' IDENTIFIED BY 'password1'; If MySQL needs to connect from different sources using a single username and password. Wildcard(%) can be used instead of an IP address. CREATE USER 'user1'@'%' IDENTIFIED BY 'password1'; % is a wildcard - It can be used as  '%.domain.com' or '%.123.123.123'  To grant privileges to a database, the user must create a database.  Following command granting privileges to a database with name 'school' GRANT ALL ON school.* TO 'user1'@'192.168.1.1'; For localhost connect...

Laravel 5.1with PHP 5.6 and MySQL 8.0

MySQL server 8.0 enabled with new user authentication mechanism. This mechanism may not supported by Laravel 5.1.x with PHP 5.x versions. It also throws exception from Laravel library for database connection. Error example: SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client The server requested authentication method unknown to the client [caching_sha2_password] To resolve errors, run the MySQL service with support of old authentication mechanism. Open mysql my.cnf (Path : 'C:\ProgramData\MySQL\MySQL Server 8.0' in windows 10 Pro) using any text editor. Update the value of  'default_authentication_plugin'  to  'mysql_native_password'. Restart MySQL service to make the updated configuration in effect.  Testing Environment Used. Windows 10 Pro MySql 8. PHP 5.6.0 Laravel 5.1