• Summary of typical scenarios in which indexes are not used in MySQL data SQL optimization


    In some cases, although there is an index, it is not selected by the optimizer. Here are some situations that the index cannot be used in the development process: 1. The like query starting with% cannot use the b-tree index. If the key value in the execution plan is null, the index is not used. […]

  • Maybe you can do this when you forget the MySQL password


    Sometimes you can clobber your configuration. As such, it’s easier to start over, as if the package had never been installed. In your case, we are looking at MySQL. 1. use Yum to Remove MySQL, like so: $ yum remove mysql mysql-server 2. removed MySQL, and safely backup the configuration: $ mv /var/lib/mysql /var/lib/mysql_old_backup 3. […]

  • Analysis of using JDBC to operate MySQL requires adding class. Forname (“com. Mysql. JDBC. Driver”)


    Introduction If you are familiar with using JDBC to connect to the database, you must know that there must be a basis for class.forname in the code to connect to the database (“com.mysql.jdbc.Driver”); public static Connection getConnection() throws ClassNotFoundException, SQLException { if(connection == null){ Class.forName(“com.mysql.jdbc.Driver”); connection = DriverManager.getConnection(“jdbc:mysql://localhost:3306/xxx?serverTimezone=UTC”, “root”, “xxxxxx”); } return connection; } I […]

  • Laravel 5.1 — get user’s login status, simple application of event, monitoring and Middleware


    There are many aspects of events, such as logging in, buying goods, searching, viewing articles, and so on. After the listener listens to the event, it performs some operations.LaravelThe observer mode is used to implement this monitoring mechanism. Now we will explain an event through a user login, monitor an event and trigger the whole […]

  • The implementation of regular backup of MySQL database


    1. Create a shell script vim backupdb.sh Create the script as follows: #!/bin/sh db_user=”root” db_passwd=”123456″ db_name=”userdb” name=”$(date +”%Y%m%d%H%M%S”)” /usr/bin/mysqldump -u$db_user -p$db_passwd $db_name >>/home/backup/$name.sql Explain: /Usr / bin / mysqldump: the path of mysqldump backup tool under the MySQL database installation directory Dbname: the name of the database to be backed up /Home / backup / […]

  • Sorting out the master-slave synchronization problems of MySQL


    This morning, MySQL synchronization failed. The main database has 530W and the slave database only has 350W. Fortunately, it’s backup. Otherwise, this is an accidentThe questions are as follows:Last_Error: Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master’s binary log is corrupted (you can check this by […]

  • The use of MySQL unique key in query and related problems


    1. Create table statement: CREATE TABLE `employees` ( `emp_no` int(11) NOT NULL, `birth_date` date NOT NULL, `first_name` varchar(14) NOT NULL, `last_name` varchar(16) NOT NULL, `gender` char(1) NOT NULL, `hire_date` date NOT NULL, PRIMARY KEY (`emp_no`), UNIQUE KEY `idxunique_first_name_gender` (`first_name`,`gender`), UNIQUE KEY `uniq_idx_firstname` (`first_name`,`gender`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 2. Add unique key: –Add unique index alter […]

  • MySQL – order by details


    0 index 1 Overview 2 Index scan sortandFile sortbrief introduction 3 Index scan sortExecution process analysis 4 File sort 5 supplementary notes 6 references 1 Overview MySQL can be implemented in two waysORDER BY: 1. Generate ordered results through index scanning 2. Use file sorting(filesort) Around these two sorts, let’s try to understandORDER BYAnd answer […]

  • 64 bit Windows 7 installation apache2.4 + php7.1 + mysql5.7 + APCU


    I want to update the software on the web server recently. I checked that the versions of Apache, PHP and MySQL are all very high, and some changes are still very big. So I need to be familiar with the installation on win first. Here is the installation configuration record: System: 64 bit windows7Time: March […]

  • How to open MySQL slow query log


    Preface The database log records all kinds of operations and events of the user to the database. It can help database administrators to track and analyze problems. MySQL provides error log, binary log, query log and slow query log. MySQL’s slow query log is a kind of log record provided by mysql. It is used […]

  • The first version of common SQL (MySQL)


    Table structure 1. List all departments with at least one employee no routine select dname from dept where deptno in(select deptno from emp); 2. How to use exists? select dname from dept where exists(select NULL from emp where emp.deptno=dept.deptno); 3. Use grouping select dname from dept where deptno in(select deptno from emp group by deptno […]

  • Fast building of node backend services


    Quickly build node backend services Based on koa2, express, MySQL and mongodb, quickly build node back-end services to realize front-end and back-end communication. objective Quickly build node backend services for different Vue projects to remove repetitive work; provide a clear process and template for the novice peers to build node services Framework and database combination […]