This is the 27th day of my participation in the August More Text Challenge

Solve the problem of slow mysql download

download

Visit the official website www.mysql.com/

Click on the DOWNLOADS

Click to Learn More

Click MYSQL Community Edition in the sidebar

Click Download MySQL Community Edition

Click on MYSQL Installer for Windows

Click on the Download

I’m going to right click here and copy the link address

Fix slow downloads

Mysql > create a new task, paste the link just copied to solve the problem of mysql download too slow.

Solve!

How to use Navicat for MySQL to operate a database

  1. After the installation, the operation interface is displayed, and the dialog box for creating a database connection is displayed

  1. You can click the test in the lower left corner to see if the connection is successful. Click OK

  1. Double-click or right-click to open a database connection

  1. Right-click to create a new database

  1. After entering, you can create a new table

  1. Add the fields of the table

7. After saving, we can see the table we just created in the table, and then we can insert data

How to use nodeJS to operate MySQL

Nodejs does not support MySQL by default, but third-party modules can be used to do this.

Use NPM to download the mysql module to help us operate the database.

(The mysql module of Node is the client)

cnpm install mysql
Copy the code
  1. The introduction of the module
const mysql = require('mysql')
Copy the code
  1. Create a connection (create a database object)

CreateConnection (which server, username, password, library)

let db = mysql.createConnection({
  host:'localhost'.user:'root'.password:'root'.database:'2020'
});
Copy the code
  1. The query

Query (SQL statement, callback)

db.query('SELECT * FROM user_table '.(err,data) = >{
  if(err)
    console.log(err);
  else
    console.log('It worked');
    console.log(JSON.stringify(data));
})
Copy the code

Simple SQL statement

Four query statements – add delete change check

  • Increase – INSERT

INSERT INTO table VALUES

INSERT INTO user_table (id,username,password) VALUES (0,’zhansan’,’345′) you can test whether the statement is correct

  • DELETE – DELETE
  • Change – UPDATE
  • Check – SELECT

SELECT what FROM table

Such as:

SELECT * FROM user_table 
Copy the code

The above is the solution record of several problems encountered in the process of using MySQL