-Linux python-django base foundation mounting mysql_20191119

Basis of this foundation python-django -linux install mysql

 

I put the database is installed on Linux,

  • 1,sudo apt-get install mysql-server
  • 2, ps -aux | grep 'mysql', if present, is installed,
  • usr / sbin / mysqld, the display, followed by a d, meaning that the default boot start,
  • 3, sudo service mysql stop, which is close the service,
  • 4, sudo service mysql restart, this is to restart the service,

Configuration:

  • Open this file, cd /etc/mysql/mysql.conf.d/ vim mysqld.cnf
  • This configuration file should not move,

Install the client,

  • Client installation command, sudo apt-get install mysql-client

The client how to use this command:

  • First log, mysql -uroot -p, enter the password
  • Then you can enter commands, and cmd window input sql same,

Graphical client

  • I want to use my Windows above, connected on the virtual machine,
  • Linux mysql need to modify the above configuration, sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
  • The # bind-address = 127.0.0.1, commented
  • Restart mysql,

not allowed to connect to this MySQL server

solution:

  • 1,mysql -u root -p
  • 2, and execute the following command:

  •  use mysql;

  •  select host from user where user='root';

  • 3, update user set host = '%' where user = 'root'; Host set "%" after allows remote access.
  • 4, flush privileges ;, allows configuration to take effect immediately,

 

Create a database

  • show databases;

  • CREATE DATABASE dailyfresh;

 

 

 

Guess you like

Origin www.cnblogs.com/andy0816/p/11892062.html
Recommended