1.Ubuntu 默認安裝 Mysql 5.6版本以上:html
1.查看系統是否安裝mysql 數據庫:mysql
sudo netstat -tap | grep mysqlsql
若是安裝了,就查看一下版本命令:數據庫
mysql --version 若是是版本5.5的話,卸載重裝。vim
卸載命令:sudo apt-get autoremove --purge mysql-server-5.5bash
2. 安裝命令:服務器
sudo apt-get install mysql-server-5.6 mysql-client-5.6性能
安裝過程設置root 密碼優化
3.ui
登入:mysql -u root -p
4.經常使用命令:
啓動服務器:sudo start mysql
中止服務器 :sudo stop mysql
重啓服務器:sudo restart mysql
5.安裝 MySQL workbench
第一種在:Ubuntu sofeware Center 輸入安裝:
第二方法,去官網下載對應Ubuntu 版本進行安裝:http://dev.mysql.com/downloads/workbench/
下載下來的DEB包,而後雙擊就能夠根據提示進行安裝了。
鏈接本地的數據庫,進行使用:
解釋: 若是mysql版本小於5.6的話,不能使用workbench 裏面提供的 Visual Explain 方法,由於這樣分析你查詢的代碼,這樣就能分析,
你代碼裏面是否循環整張表,從而提升系統性能的分析,查看複雜語句性能分析的時候,能夠快速的查看出來,能夠進行優化。
6.Ubuntu不支持大小忽略 配置:
1: sudo vim /etc/mysql/my.cnf
2.在[mysqld]下加入一行:lower_case_table_names=1
3.從新啓動數據庫:
1.下載:mysql-5.6.27-winx64.zip
2.而後解壓到對應的路徑個人路徑爲:D:\Program Files\MySQL\mysql-5.6.27-winx64
3.拷貝一份 my-default.ini 文件,取名爲my.ini
修改裏面的兩個屬性:
basedir =D:\Program Files\MySQL\mysql-5.6.27-winx64
datadir =D:\Program Files\MySQL\mysql-5.6.27-winx64\data
4.配置全局變量:
MYSQL_HOME D:\Program Files\MySQL\mysql-5.6.27-winx64
PATH %MYSQL_HOME%\bin
5.進入命令行模式使用管理員打開cmd 窗口:
必定要進入到你mysql的安裝目錄如:
cd :D:\Program Files\MySQL\mysql-5.6.27-winx64\bin
6. 執行安裝命令
mysqld -install
7.啓動數據庫後臺進程
net start mysql
8.刪除命令:
mysqld -remove
其中我my.ini的配置文件:
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html # *** DO NOT EDIT THIS FILE. It's a template which will be copied to the # *** default location during install, and will be replaced if you # *** upgrade to a newer version of MySQL. [mysqld] # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # These are commonly set, remove the # and set as required. # basedir = ..... # datadir = ..... # port = ..... # server_id = ..... basedir=D:/Program Files/MySQL/mysql-5.6.24-winx64 datadir=D:/Program Files/MySQL/mysql-5.6.24-winx64/data port=13306 #本身定義端口 character-set-server=utf8 default-storage-engine=INNODB innodb_data_home_dir=D:/Program Files/MySQL/mysql-5.6.24-winx64/data innodb_data_file_path=ibdata1:12M:autoextend innodb_log_group_home_dir=D:/Program Files/MySQL/mysql-5.6.24-winx64/data innodb_buffer_pool_size=10240M innodb_log_file_size=4G # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES