B station learning video source
overview
a brief introdction
Programmers use SQL to control the database management system (MySQL) to operate on the database.
data model
The dept_id of Zhang Wuji in the first table is 1, and this dept_id is the id of the second table. These tables are connected to each other, so they become a relational database.
Users can create a database by using a relational database (DBMS), create a data table in the database, and further create data in the data table. This is the data model of MySQL.
Win10 installation
The installation can be installed according to this blog MySQL (detailed, suitable for novices) , very simple.
environment variable
Here I will talk about the configuration after installation. First, you can configure the environment variables, so that you don’t have to start it in the bin\ directory every time.
as follows:
Just add a path, which is the location corresponding to bin\.
Then make sure all the way, exit, and re-enter mysql.
change Password
- To run cmd (command prompt) as an administrator, you must be an administrator, and it will be the same in the future.
- Enter
net start mysql
, start successfully - Enter
mysql -u root -p
, success after entering the password
- Enter
ALTER USER 'root'@'localhost' IDENTIFIED BY '密码';
the password is the password you want to set,
for exampleALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
, remember to add a semicolon, and then you can use the new password for the next login.
Create a startup script
Create a new text on the desktop, rename it, and change it to a file with the suffix .bat
Then copy the following code and save it. Note that after -p is your own password, write directly next to -p without spaces .
@%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit cd /d "%~dp0"
net start mysql
mysql -u root -p123456
@net stop mysql
Then double-click to run this file to automatically open mysql.
When exiting, enter quit;
, you can automatically exit mysql and stop the service.
Currently there is the latest permanent version. Considering the problem of resources, please private message me if you need it.
Install DataGrip2021.2
Install the old version, you can try the 30-day version for free,
download the compressed package
, then unzip it to your designated directory, enter the bin file, find the exe,
right-click to create a shortcut, drag it to the desktop, and then rename it.
Download another file: https://pan.baidu.com/s/1hM0ywuFxO3I51BjiVORMeQ
Extraction code: gzua
Then open DataGrip, apply for 30 days of use, and then create a project
After entering the project, manually drag the file to the gray area in the middle, and restart when prompted to restart.
After restarting, click Help to see the name of the plugin below, and you can use it casually in the future.
Then find the MySQL in the data source on the plus sign on the left and configure it. Remember to start the mysql service before testing the connection.
Install MySQL on ubuntu18.04
Install
Open the command line and enter the following commands in sequence:
-
sudo apt-get update
-
sudo apt-get install mysql-server
-
Enter
sudo mysql -u root -p
Enter the password as root to enter mysql.
But now you have to use sudo to enter mysql, we can fix this as shown below. -
update user set plugin = 'mysql_native_password' where user = 'root';
- mysql_native_password is the encryption method of mysql5.7 version (ubuntu18.04 uses this).
- caching_sha2_password is the encryption method of mysql8.0 version.
-
quit;
-
sudo service mysql restart
restart the mysql service -
sudo mysql -u root
Enter mysql without password -
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
Change password
(123456 is the login password to be changed) -
quit;
-
mysql -u root -p
Then enter the password you just modified to log in normally.
remote link
Because our current user is 'root'@'localhost', that is to say, the root user can only log in to the database at localhost (local). If we want to access it in windows, we must create a new user
-
CREATE USER 'root'@'%' identified with mysql_native_password by '1234';
-
Assign it all permissions:
grant all on *.* to 'root'@'%';
-
quit;
-
Enter
sudo gedit /etc/mysql/mysql.conf.d/mysqld.cnf
, modify the file, comment out bing-address, then save and exit
-
restart mysql:
sudo service mysql restart
-
Enter
ifconfig
to view the ip of ubuntu -
Log in to DataGrip and connect to mysql under Windows.