初用MySQL Mysql示例庫 Navicat15

初用MySQL Mysql示例庫 Navicat15

 

查看初始密碼

MySQl首次啓動會建立「超級管理員帳號」root@localhost,初始密碼存儲在日誌文件中,經過grep搜索並查看:html

grep 'temporary password' /var/log/mysqld.log

 

進入mysql

mysql -u root -p

經過鍵入密碼(上一步查詢到的密碼)的方式以root身份進入mysqlmysql

請注意,這裏的root身份是指mysql系統中的「超級管理員」root,而不是操做系統的root,由於以下圖,只密碼正確,以es用戶也能夠以root用戶身份登入mysqllinux

 

修改默認密碼

alter user 'root'@'localhost' identified by 'yourselfPassword'

若是出現git

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

則說明你本身設置的密碼沒有到達MySQL默認的最低標準---字母、數字、符號github

出現sql

Query OK, 0 rows affected (0.00 sec)

則說明修改爲功shell

 

官網示例數據庫

https://dev.mysql.com/doc/index-other.html

(期中world_x database是world database的「升級版」)數據庫

 

world_X示例庫

官方Doc連接ide

https://dev.mysql.com/doc/world-x-setup/en/world-x-setup-installation.html
  • 下載測試

    經過wget --spider測試下載鏈接

    wget --spider https://downloads.mysql.com/docs/world_x-db.tar.gz

    若以下顯示則說明鏈接有效

    再下載tgz壓縮包到想要的位置

    wget https://downloads.mysql.com/docs/world_x-db.tar.gz
  • 解壓tgz

  • source命令導入數據庫

    source /yourPathTo/world_x.sql

    登入MySQL shell後直接使用source命令會默認以.sql文件的文件名建立同名的數據庫,手動起名的方式詳見此處

  • 檢驗:

 

sakila

  • sakila是一個擁有不少table的數據庫,用於當作租借光盤的商店所使用Mysql的數據庫。涉及電影、演員、類別、客戶、付款等等

  • 下載並解壓

    wget https://downloads.mysql.com/docs/sakila-db.tar.gz
  • 進入Mysql shell,使用sakila-schema.sql建立數據庫結構,使用sakila-data.sql填充數據

    Mysql -u root -p
    source /yourPathTp/sakila-db/sakila-schema.sql
    source /yourPathTp/sakila-db/sakila-data.sql
  • 優秀的使用示例

    https://dev.mysql.com/doc/sakila/en/sakila-usage.html

 

employee data (large dataset, includes data and test/verification suite)

  • 員工樣本數據庫提供了六個單獨的表,總共包含400萬條記錄。該結構與各類存儲引擎類型兼容。經過包含的數據文件,還提供了對分區表的支持。

  • 下載並解壓(zip)

    wget https://github.com/datacharmer/test_db/archive/master.zip
    yum install -y unzip zip
    unzip master.zip
  • 須要在employee.sql所在文件夾執行導入命令

    mysql -t -u root -p < employees.sql

    若是不是在employee.sql所在文件夾執行,或者在已經開啓的Mysql shell使用source方式導入,會產生以下報錯:

    ERROR: 
    Failed to open file 'load_salaries1.dump', error: 2
    ERROR: 
    Failed to open file 'load_salaries2.dump', error: 2
    ERROR: 
    Failed to open file 'load_salaries3.dump', error: 2
    ERROR: 
    Failed to open file 'show_elapsed.sql', error: 2
  • 如圖則導入成功:

  

更多導入導出方式

https://www.runoob.com/w3cnote/linux-mysql-import-export-data.html

 

navicat 15 安裝:

https://www.cnblogs.com/kkdaj/p/12794804.html

解決navicat建立鏈接 1130 error

mysql -uroot -p
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Gwj332017&' WITH GRANT OPTION;
FLUSH PRIVILEGES
相關文章
相關標籤/搜索