luffy之資料庫配置

xshlife2發表於2020-12-22

一:建立資料庫

1.登入
mysql -u root -p [密碼]
2.建立資料庫
create database luffy default charset=utf8;
3.檢視使用者
select user,host,password from mysql.user;
5.7之後的版本
select user,host,authentication_string from mysql.user;
二:為指定資料庫配置指定賬戶
為了增加資料庫的安全性,單獨建立1個使用者(任何人都可以遠端連線),該使用者只對這個庫有許可權,沒有其他許可權

1.配置任意IP都可以連入資料庫的賬戶(配置1個賬戶:luffy,只對luffy資料庫有許可權)
grant all privileges on luffy.* to ‘luffy’@’%’ identified by ‘Luffy123?’;
2.由於資料庫版本的問題,可能本地還連線不上,就給本地使用者單獨配置
grant all privileges on luffy.* to ‘luffy’@‘localhost’ identified by ‘Luffy123?’;
3.重新整理許可權
flush privileges;
4.賬號密碼(只能操作luffy資料庫的賬戶)
資料庫 luffy
賬號 luffy
密碼 Luffy123?

5.測試連線
格式:mysql -h [IP地址] -u [使用者名稱] -p[密碼]

mysql -h 127.0.0.1 -u luffy -pLuffy123?
三:Django中的資料庫配置
複製程式碼
DATABASES = {
‘default’: {
‘ENGINE’: ‘django.db.backends.mysql’,
‘NAME’: ‘luffy’,
‘USER’: ‘luffy’,
‘PASSWORD’: ‘Luffy123?’,
‘HOST’: ‘localhost’,
‘PORT’: 3306
}
}

import pymysql

pymysql.install_as_MySQLdb()
https://github.com/users/hbfs25505/projects/544
https://www.github.com/users/hbfs25505/projects/544
https://github.com/users/hbfs25505/projects/545
https://www.github.com/users/hbfs25505/projects/545
https://github.com/users/hbfs25505/projects/546
https://www.github.com/users/hbfs25505/projects/546
https://github.com/users/hbfs25505/projects/547
https://www.github.com/users/hbfs25505/projects/547
https://github.com/users/hbfs25505/projects/548
https://www.github.com/users/hbfs25505/projects/548
https://github.com/users/hbfs25505/projects/549
https://www.github.com/users/hbfs25505/projects/549
https://github.com/users/hbfs25505/projects/550
https://www.github.com/users/hbfs25505/projects/550
https://github.com/users/hbfs25505/projects/551
https://www.github.com/users/hbfs25505/projects/551
https://github.com/users/hbfs25505/projects/552
https://www.github.com/users/hbfs25505/projects/552
https://github.com/users/hbfs25505/projects/553
https://www.github.com/users/hbfs25505/projects/553
https://github.com/users/hbfs25505/projects/554
https://www.github.com/users/hbfs25505/projects/554
https://github.com/users/hbfs25505/projects/555
https://www.github.com/users/hbfs25505/projects/555
https://github.com/users/hbfs25505/projects/556
https://www.github.com/users/hbfs25505/projects/556
https://github.com/users/hbfs25505/projects/557
https://www.github.com/users/hbfs25505/projects/557
https://github.com/users/hbfs25505/projects/558
https://www.github.com/users/hbfs25505/projects/558
https://github.com/users/hbfs25505/projects/559
https://www.github.com/users/hbfs25505/projects/559
https://github.com/users/hbfs25505/projects/560
https://www.github.com/users/hbfs25505/projects/560
https://github.com/users/hbfs25505/projects/561
https://www.github.com/users/hbfs25505/projects/561
https://github.com/users/hbfs25505/projects/562
https://www.github.com/users/hbfs25505/projects/562
https://github.com/users/hbfs25505/projects/563
https://www.github.com/users/hbfs25505/projects/563
https://github.com/users/hbfs25505/projects/564
https://www.github.com/users/hbfs25505/projects/564
https://github.com/users/hbfs25505/projects/565
https://www.github.com/users/hbfs25505/projects/565
https://github.com/users/hbfs25505/projects/566
https://www.github.com/users/hbfs25505/projects/566
https://github.com/users/hbfs25505/projects/567
https://www.github.com/users/hbfs25505/projects/567
https://github.com/users/hbfs25505/projects/568
https://www.github.com/users/hbfs25505/projects/568
https://github.com/users/hbfs25505/projects/569
https://www.github.com/users/hbfs25505/projects/569
https://github.com/users/hbfs25505/projects/570
https://www.github.com/users/hbfs25505/projects/570
https://github.com/users/hbfs25505/projects/571
https://www.github.com/users/hbfs25505/projects/571
https://github.com/users/hbfs25505/projects/572
https://www.github.com/users/hbfs25505/projects/572
https://github.com/users/hbfs25505/projects/573
https://www.github.com/users/hbfs25505/projects/573
https://github.com/users/hbfs25505/projects/574
https://www.github.com/users/hbfs25505/projects/574
https://github.com/users/hbfs25505/projects/575
https://www.github.com/users/hbfs25505/projects/575
https://github.com/users/hbfs25505/projects/576
https://www.github.com/users/hbfs25505/projects/576
https://github.com/users/hbfs25505/projects/577
https://www.github.com/users/hbfs25505/projects/577
https://github.com/users/hbfs25505/projects/578
https://www.github.com/users/hbfs25505/projects/578
https://github.com/users/hbfs25505/projects/579
https://www.github.com/users/hbfs25505/projects/579
https://github.com/users/hbfs25505/projects/580
https://www.github.com/users/hbfs25505/projects/580
https://github.com/users/hbfs25505/projects/581
https://www.github.com/users/hbfs25505/projects/581
https://github.com/users/hbfs25505/projects/582
https://www.github.com/users/hbfs25505/projects/582
https://github.com/users/hbfs25505/projects/583
https://www.github.com/users/hbfs25505/projects/583
https://github.com/users/hbfs25505/projects/584
https://www.github.com/users/hbfs25505/projects/584
https://github.com/users/hbfs25505/projects/585
https://www.github.com/users/hbfs25505/projects/585
https://github.com/users/hbfs25505/projects/586
https://www.github.com/users/hbfs25505/projects/586
https://github.com/users/hbfs25505/projects/587
https://www.github.com/users/hbfs25505/projects/587
https://github.com/users/hbfs25505/projects/588
https://www.github.com/users/hbfs25505/projects/588
https://github.com/users/hbfs25505/projects/589
https://www.github.com/users/hbfs25505/projects/589
https://github.com/users/hbfs25505/projects/590
https://www.github.com/users/hbfs25505/projects/590
https://github.com/users/hbfs25505/projects/591
https://www.github.com/users/hbfs25505/projects/591
https://github.com/users/hbfs25505/projects/592
https://www.github.com/users/hbfs25505/projects/592
https://github.com/users/hbfs25505/projects/593
https://www.github.com/users/hbfs25505/projects/593
https://github.com/users/hbfs25505/projects/594
https://www.github.com/users/hbfs25505/projects/594
https://github.com/users/hbfs25505/projects/595
https://www.github.com/users/hbfs25505/projects/595
https://github.com/users/hbfs25505/projects/596
https://www.github.com/users/hbfs25505/projects/596
https://github.com/users/hbfs25505/projects/597
https://www.github.com/users/hbfs25505/projects/597
https://github.com/users/hbfs25505/projects/598
https://www.github.com/users/hbfs25505/projects/598
https://github.com/users/hbfs25505/projects/599
https://www.github.com/users/hbfs25505/projects/599
https://github.com/users/hbfs25505/projects/600
https://www.github.com/users/hbfs25505/projects/600
https://github.com/users/hbfs25505/projects/601
https://www.github.com/users/hbfs25505/projects/601
https://github.com/users/hbfs25505/projects/602
https://www.github.com/users/hbfs25505/projects/602
https://github.com/users/hbfs25505/projects/603
https://www.github.com/users/hbfs25505/projects/603
https://github.com/users/hbfs25505/projects/604
https://www.github.com/users/hbfs25505/projects/604
https://github.com/users/hbfs25505/projects/605
https://www.github.com/users/hbfs25505/projects/605
https://github.com/users/hbfs25505/projects/606
https://www.github.com/users/hbfs25505/projects/606
https://github.com/users/hbfs25505/projects/607
https://www.github.com/users/hbfs25505/projects/607
https://github.com/users/hbfs25505/projects/608
https://www.github.com/users/hbfs25505/projects/608
https://github.com/users/hbfs25505/projects/609
https://www.github.com/users/hbfs25505/projects/609
https://github.com/users/hbfs25505/projects/610
https://www.github.com/users/hbfs25505/projects/610
https://github.com/users/hbfs25505/projects/611
https://www.github.com/users/hbfs25505/projects/611
https://github.com/users/hbfs25505/projects/612
https://www.github.com/users/hbfs25505/projects/612
https://github.com/users/hbfs25505/projects/613
https://www.github.com/users/hbfs25505/projects/613
https://github.com/users/hbfs25505/projects/614
https://www.github.com/users/hbfs25505/projects/614
https://github.com/users/hbfs25505/projects/615
https://www.github.com/users/hbfs25505/projects/615
https://github.com/users/hbfs25505/projects/616
https://www.github.com/users/hbfs25505/projects/616
https://github.com/users/hbfs25505/projects/617
https://www.github.com/users/hbfs25505/projects/617
https://github.com/users/hbfs25505/projects/618
https://www.github.com/users/hbfs25505/projects/618
https://github.com/users/hbfs25505/projects/619
https://www.github.com/users/hbfs25505/projects/619
https://github.com/users/hbfs25505/projects/620
https://www.github.com/users/hbfs25505/projects/620
https://github.com/users/hbfs25505/projects/621
https://www.github.com/users/hbfs25505/projects/621
https://github.com/users/hbfs25505/projects/622
https://www.github.com/users/hbfs25505/projects/622
https://github.com/users/hbfs25505/projects/623
https://www.github.com/users/hbfs25505/projects/623
https://github.com/users/hbfs25505/projects/624
https://www.github.com/users/hbfs25505/projects/624
https://github.com/users/hbfs25505/projects/625
https://www.github.com/users/hbfs25505/projects/625
https://github.com/users/hbfs25505/projects/626
https://www.github.com/users/hbfs25505/projects/626
https://github.com/users/hbfs25505/projects/627
https://www.github.com/users/hbfs25505/projects/627
https://github.com/users/hbfs25505/projects/628
https://www.github.com/users/hbfs25505/projects/628
https://github.com/users/hbfs25505/projects/629
https://www.github.com/users/hbfs25505/projects/629
https://github.com/users/hbfs25505/projects/630
https://www.github.com/users/hbfs25505/projects/630
https://github.com/users/hbfs25505/projects/631
https://www.github.com/users/hbfs25505/projects/631
https://github.com/users/hbfs25505/projects/632
https://www.github.com/users/hbfs25505/projects/632
https://github.com/users/hbfs25505/projects/633
https://www.github.com/users/hbfs25505/projects/633
https://github.com/users/hbfs25505/projects/634
https://www.github.com/users/hbfs25505/projects/634
https://github.com/users/hbfs25505/projects/635
https://www.github.com/users/hbfs25505/projects/635
https://github.com/users/hbfs25505/projects/636
https://www.github.com/users/hbfs25505/projects/636
https://github.com/users/hbfs25505/projects/637
https://www.github.com/users/hbfs25505/projects/637
https://github.com/users/hbfs25505/projects/638
https://www.github.com/users/hbfs25505/projects/638
https://github.com/users/hbfs25505/projects/639
https://www.github.com/users/hbfs25505/projects/639
https://github.com/users/hbfs25505/projects/640
https://www.github.com/users/hbfs25505/projects/640
https://github.com/users/hbfs25505/projects/641
https://www.github.com/users/hbfs25505/projects/641
https://github.com/users/hbfs25505/projects/642
https://www.github.com/users/hbfs25505/projects/642
https://github.com/users/hbfs25505/projects/643
https://www.github.com/users/hbfs25505/projects/643
https://github.com/users/hbfs25505/projects/644
https://www.github.com/users/hbfs25505/projects/644
https://github.com/users/hbfs25505/projects/645
https://www.github.com/users/hbfs25505/projects/645
https://github.com/users/hbfs25505/projects/646
https://www.github.com/users/hbfs25505/projects/646
https://github.com/users/hbfs25505/projects/647
https://www.github.com/users/hbfs25505/projects/647
https://github.com/users/hbfs25505/projects/648
https://www.github.com/users/hbfs25505/projects/648
https://github.com/users/hbfs25505/projects/649
https://www.github.com/users/hbfs25505/projects/649
https://github.com/users/hbfs25505/projects/650
https://www.github.com/users/hbfs25505/projects/650
https://github.com/users/hbfs25505/projects/651
https://www.github.com/users/hbfs25505/projects/651
https://github.com/users/hbfs25505/projects/652
https://www.github.com/users/hbfs25505/projects/652
https://github.com/users/hbfs25505/projects/653
https://www.github.com/users/hbfs25505/projects/653
https://github.com/users/hbfs25505/projects/654
https://www.github.com/users/hbfs25505/projects/654
https://github.com/users/hbfs25505/projects/655
https://www.github.com/users/hbfs25505/projects/655
https://github.com/users/hbfs25505/projects/656
https://www.github.com/users/hbfs25505/projects/656
https://github.com/users/hbfs25505/projects/657
https://www.github.com/users/hbfs25505/projects/657
https://github.com/users/hbfs25505/projects/658
https://www.github.com/users/hbfs25505/projects/658
https://github.com/users/hbfs25505/projects/659
https://www.github.com/users/hbfs25505/projects/659
https://github.com/users/hbfs25505/projects/660
https://www.github.com/users/hbfs25505/projects/660
https://github.com/users/hbfs25505/projects/661
https://www.github.com/users/hbfs25505/projects/661
https://github.com/users/hbfs25505/projects/662
https://www.github.com/users/hbfs25505/projects/662
https://github.com/users/hbfs25505/projects/663
https://www.github.com/users/hbfs25505/projects/663
https://github.com/users/hbfs25505/projects/664
https://www.github.com/users/hbfs25505/projects/664
https://github.com/users/hbfs25505/projects/665
https://www.github.com/users/hbfs25505/projects/665
https://github.com/users/hbfs25505/projects/666
https://www.github.com/users/hbfs25505/projects/666
https://github.com/users/hbfs25505/projects/667
https://www.github.com/users/hbfs25505/projects/667
https://github.com/users/hbfs25505/projects/668
https://www.github.com/users/hbfs25505/projects/668
https://github.com/users/hbfs25505/projects/669
https://www.github.com/users/hbfs25505/projects/669
https://github.com/users/hbfs25505/projects/670
https://www.github.com/users/hbfs25505/projects/670
https://github.com/users/hbfs25505/projects/671
https://www.github.com/users/hbfs25505/projects/671
https://github.com/users/hbfs25505/projects/672
https://www.github.com/users/hbfs25505/projects/672
https://github.com/users/hbfs25505/projects/673
https://www.github.com/users/hbfs25505/projects/673
https://github.com/users/hbfs25505/projects/674
https://www.github.com/users/hbfs25505/projects/674
https://github.com/users/hbfs25505/projects/675
https://www.github.com/users/hbfs25505/projects/675
https://github.com/users/hbfs25505/projects/676
https://www.github.com/users/hbfs25505/projects/676
https://github.com/users/hbfs25505/projects/677
https://www.github.com/users/hbfs25505/projects/677
https://github.com/users/hbfs25505/projects/678
https://www.github.com/users/hbfs25505/projects/678
https://github.com/users/hbfs25505/projects/679
https://www.github.com/users/hbfs25505/projects/679
https://github.com/users/hbfs25505/projects/680
https://www.github.com/users/hbfs25505/projects/680
https://github.com/users/hbfs25505/projects/681
https://www.github.com/users/hbfs25505/projects/681
https://github.com/users/hbfs25505/projects/682
https://www.github.com/users/hbfs25505/projects/682
https://github.com/users/hbfs25505/projects/683
https://www.github.com/users/hbfs25505/projects/683
https://github.com/users/hbfs25505/projects/684
https://www.github.com/users/hbfs25505/projects/684
https://github.com/users/hbfs25505/projects/685
https://www.github.com/users/hbfs25505/projects/685
https://github.com/users/hbfs25505/projects/686
https://www.github.com/users/hbfs25505/projects/686
https://github.com/users/hbfs25505/projects/687
https://www.github.com/users/hbfs25505/projects/687
https://github.com/users/hbfs25505/projects/688
https://www.github.com/users/hbfs25505/projects/688
https://github.com/users/hbfs25505/projects/689
https://www.github.com/users/hbfs25505/projects/689
https://github.com/users/hbfs25505/projects/690
https://www.github.com/users/hbfs25505/projects/690
https://github.com/users/hbfs25505/projects/691
https://www.github.com/users/hbfs25505/projects/691
https://github.com/users/hbfs25505/projects/692
https://www.github.com/users/hbfs25505/projects/692
https://github.com/users/hbfs25505/projects/693
https://www.github.com/users/hbfs25505/projects/693
https://github.com/users/hbfs25505/projects/694
https://www.github.com/users/hbfs25505/projects/694
https://github.com/users/hbfs25505/projects/695
https://www.github.com/users/hbfs25505/projects/695
https://github.com/users/hbfs25505/projects/696
https://www.github.com/users/hbfs25505/projects/696
https://github.com/users/hbfs25505/projects/697
https://www.github.com/users/hbfs25505/projects/697
https://github.com/users/hbfs25505/projects/698
https://www.github.com/users/hbfs25505/projects/698
https://github.com/users/hbfs25505/projects/699
https://www.github.com/users/hbfs25505/projects/699
https://github.com/users/hbfs25505/projects/700
https://www.github.com/users/hbfs25505/projects/700
https://github.com/users/hbfs25505/projects/701
https://www.github.com/users/hbfs25505/projects/701
https://github.com/users/hbfs25505/projects/702
https://www.github.com/users/hbfs25505/projects/702
https://github.com/users/hbfs25505/projects/703
https://www.github.com/users/hbfs25505/projects/703
https://github.com/users/hbfs25505/projects/704
https://www.github.com/users/hbfs25505/projects/704
https://github.com/users/hbfs25505/projects/705
https://www.github.com/users/hbfs25505/projects/705
https://github.com/users/hbfs25505/projects/706
https://www.github.com/users/hbfs25505/projects/706
https://github.com/users/hbfs25505/projects/707
https://www.github.com/users/hbfs25505/projects/707
https://github.com/users/hbfs25505/projects/708
https://www.github.com/users/hbfs25505/projects/708
https://github.com/users/hbfs25505/projects/709
https://www.github.com/users/hbfs25505/projects/709
https://github.com/users/hbfs25505/projects/710
https://www.github.com/users/hbfs25505/projects/710
https://github.com/users/hbfs25505/projects/711
https://www.github.com/users/hbfs25505/projects/711
https://github.com/users/hbfs25505/projects/712
https://www.github.com/users/hbfs25505/projects/712
https://github.com/users/hbfs25505/projects/713
https://www.github.com/users/hbfs25505/projects/713
https://github.com/users/hbfs25505/projects/714
https://www.github.com/users/hbfs25505/projects/714
https://github.com/users/hbfs25505/projects/715
https://www.github.com/users/hbfs25505/projects/715
https://github.com/users/hbfs25505/projects/716
https://www.github.com/users/hbfs25505/projects/716
https://github.com/users/hbfs25505/projects/717
https://www.github.com/users/hbfs25505/projects/717
https://github.com/users/hbfs25505/projects/718
https://www.github.com/users/hbfs25505/projects/718
https://github.com/users/hbfs25505/projects/719
https://www.github.com/users/hbfs25505/projects/719
https://github.com/users/hbfs25505/projects/720
https://www.github.com/users/hbfs25505/projects/720
https://github.com/users/hbfs25505/projects/721
https://www.github.com/users/hbfs25505/projects/721
https://github.com/users/hbfs25505/projects/722
https://www.github.com/users/hbfs25505/projects/722
https://github.com/users/hbfs25505/projects/723
https://www.github.com/users/hbfs25505/projects/723
https://github.com/users/hbfs25505/projects/724
https://www.github.com/users/hbfs25505/projects/724
https://github.com/users/hbfs25505/projects/725
https://www.github.com/users/hbfs25505/projects/725
https://github.com/users/hbfs25505/projects/726
https://www.github.com/users/hbfs25505/projects/726
https://github.com/users/hbfs25505/projects/727
https://www.github.com/users/hbfs25505/projects/727
https://github.com/users/hbfs25505/projects/728
https://www.github.com/users/hbfs25505/projects/728
https://github.com/users/hbfs25505/projects/729
https://www.github.com/users/hbfs25505/projects/729
https://github.com/users/hbfs25505/projects/730
https://www.github.com/users/hbfs25505/projects/730
https://github.com/users/hbfs25505/projects/731
https://www.github.com/users/hbfs25505/projects/731
https://github.com/users/hbfs25505/projects/732
https://www.github.com/users/hbfs25505/projects/732
https://github.com/users/hbfs25505/projects/733
https://www.github.com/users/hbfs25505/projects/733
https://github.com/users/hbfs25505/projects/734
https://www.github.com/users/hbfs25505/projects/734
https://github.com/users/hbfs25505/projects/735
https://www.github.com/users/hbfs25505/projects/735
https://github.com/users/hbfs25505/projects/736
https://www.github.com/users/hbfs25505/projects/736
https://github.com/users/hbfs25505/projects/737
https://www.github.com/users/hbfs25505/projects/737
https://github.com/users/hbfs25505/projects/738
https://www.github.com/users/hbfs25505/projects/738
https://github.com/users/hbfs25505/projects/739
https://www.github.com/users/hbfs25505/projects/739
https://github.com/users/hbfs25505/projects/740
https://www.github.com/users/hbfs25505/projects/740
https://github.com/users/hbfs25505/projects/741
https://www.github.com/users/hbfs25505/projects/741
https://github.com/users/hbfs25505/projects/742
https://www.github.com/users/hbfs25505/projects/742
https://github.com/users/hbfs25505/projects/743
https://www.github.com/users/hbfs25505/projects/743
https://github.com/users/hbfs25505/projects/744
https://www.github.com/users/hbfs25505/projects/744
https://github.com/users/hbfs25505/projects/745
https://www.github.com/users/hbfs25505/projects/745
https://github.com/users/hbfs25505/projects/746
https://www.github.com/users/hbfs25505/projects/746
https://github.com/users/hbfs25505/projects/747
https://www.github.com/users/hbfs25505/projects/747
https://github.com/users/hbfs25505/projects/748
https://www.github.com/users/hbfs25505/projects/748
https://github.com/users/hbfs25505/projects/749
https://www.github.com/users/hbfs25505/projects/749
https://github.com/users/hbfs25505/projects/750
https://www.github.com/users/hbfs25505/projects/750
https://github.com/users/hbfs25505/projects/751
https://www.github.com/users/hbfs25505/projects/751
https://github.com/users/hbfs25505/projects/752
https://www.github.com/users/hbfs25505/projects/752
https://github.com/users/hbfs25505/projects/753
https://www.github.com/users/hbfs25505/projects/753
https://github.com/users/hbfs25505/projects/754
https://www.github.com/users/hbfs25505/projects/754
https://github.com/users/hbfs25505/projects/755
https://www.github.com/users/hbfs25505/projects/755
https://github.com/users/hbfs25505/projects/756
https://www.github.com/users/hbfs25505/projects/756
https://github.com/users/hbfs25505/projects/757
https://www.github.com/users/hbfs25505/projects/757
https://github.com/users/hbfs25505/projects/758
https://www.github.com/users/hbfs25505/projects/758
https://github.com/users/hbfs25505/projects/759
https://www.github.com/users/hbfs25505/projects/759

相關文章