Time of Update: 2015-11-20
標籤:轉自: http://codingstandards.iteye.com/blog/604541MySQL中匯出CSV格式資料的SQL語句樣本如下: select * from test_info into outfile ‘/tmp/test.csv‘ fields terminated by ‘,‘ optionally enclosed by ‘"‘ escaped by ‘"‘ lines terminated by ‘\r\n‘;
Time of Update: 2015-11-20
標籤:CentOS7的yum源中預設好像是沒有mysql的。為瞭解決這個問題,我們要先下載mysql的repo源。1. 下載mysql的repo源$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm2. 安裝mysql-community-release-el7-5.noarch.rpm包$ sudo rpm -ivh mysql-community-
Time of Update: 2015-11-23
標籤:mysql MySQL includes character set support that enables you to store data using a variety of character sets and perform compariso
Time of Update: 2015-11-23
標籤:mysql MySQL includes character set support that enables you to store data using a variety of character sets and perform compariso
Time of Update: 2015-11-20
標籤:MySQL:1》:http://www.mysql.com/products/connector/2》//jdbc:[資料庫類型]://[ip地址]:[連接埠號碼]/[資料庫名] private String url = "jdbc:mysql://localhost:3306/userdata"; private String driver = "com.mysql.jdbc.Driver"; private String user = "root";
Time of Update: 2015-11-20
標籤:讀寫分離(Read/Write
Time of Update: 2015-11-20
標籤:資料庫操作 以下這張圖是MySQL服務當中經過的一些組件介紹。還是比較詳細的,所以此圖經常拿來看看也能對MySQL的整個架構加深點印象。650) this.width=650;" src="http://s1.51cto.com/wyfs02/M00/76/43/wKiom1ZOe4PCv9OOAAoKxCn2N6Q538.jpg" title="Mysql architecture.jpg" width="720" height="468"
Time of Update: 2015-11-17
標籤:想上傳一張圖片,可以前台用input type=‘file‘ name=‘file‘,後台用類似$_post的東西$_FILES[‘file‘]來接收,$_FILES這玩意也是個超級全域變數,有[‘name‘],[‘size‘]這些屬性。前台多了一個表單域,後台自然也要對應多一列了,sql語句麼alter table tablename add column pic varchar(50).前台背景東西都有了,就把資料插進資料庫把。$pic=$_FILES[‘file‘][‘name‘];
Time of Update: 2015-11-22
標籤: 1、刪除 mysql1 sudo apt-get autoremove --purge mysql-server-5.0 2 sudo apt-get remove mysql-server 3 sudo apt-get autoremove mysql-server 4 sudo apt-get remove mysql-common (非常重要) 上面的其實有一些是多餘的,建議還是按照順序執行一遍重點:[清理殘留資料]dpkg -l |grep ^rc|awk
Time of Update: 2015-11-17
標籤:方法1: 用SET PASSWORD命令 mysql -u root mysql> SET PASSWORD FOR ‘root‘@‘localhost‘ = PASSWORD(‘newpass‘); 方法2:用mysqladmin mysqladmin -u root password "newpass" 如果root已經設定過密碼,採用如下方法 mysqladmin -u root password oldpass "newpass" 方法3:
Time of Update: 2015-11-18
標籤:1、插入記錄: 方法一:INSERT [INTO] tbl_name [(col_name,···)] {VALUES|VALUE} ({expr |DEFAULT},···),(···),···例如: INSERT
Time of Update: 2015-11-18
標籤: 網上推薦的Python操作資料庫的方法是調用 MySQL for Python,也有人稱之為MySQLdb,原因是這個是C寫的,速度快。 ubuntu下用pip安裝第三方庫. sudo pip install
Time of Update: 2015-11-17
標籤:BEGIN#Routine body goes here... DECLARE no_more_record INT DEFAULT 0; DECLARE TEST_ID INT(20); DECLARE TEST_USERNAME VARCHAR(20); DECLARE TEST_SEX INT(2); DECLARE TEST_ADDRESS VARCHAR(20); DECLARE cur_record CURSOR FOR SELECT id,
Time of Update: 2015-11-18
標籤:1.庫名、表名、欄位名必須使用小寫字母,並採用底線分割。a)MySQL有配置參數lower_case_table_names,不可動態更改,linux系統預設為 0,即庫表名以實際情況儲存,大小寫敏感。如果是1,以小寫儲存,大小寫不敏感。如果是2,以實際情況儲存,但以小寫比較。b)如果大小寫混合使用,可能存在abc,Abc,ABC等多個表共存,容易導致混亂。c)欄位名顯式區分大小寫,但實際使用不區分,即不可以建立兩個名字一樣但大小寫不一樣的欄位。d)為了統一規範,
Time of Update: 2015-11-16
標籤:我這個項目是MVC4的,有兩個版本,第一個版本直接運行沒什麼問題,但是跑第二個版本的時候就給我提示這個錯誤。好吧,百度果然是萬能的。下邊是解決方案。1、找到 C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config這個鬼東西,然後把裡面的MySql.Web.v20改成MySql.Web,儲存可以。(記得先複製一個版本放著,誰知道可不可行?)2、到控制台裡面把MySQL改一下。找到下面這個叫mySQL
Time of Update: 2015-11-18
標籤:錯誤提示:General error: 1366 Incorrect integer value: ‘‘ for column ‘pay_type‘ at row 1 (SQL: INSERT INTO `issues` (`player_game_id`, `urgency_degree`, `source`, `channel_forum`, `issue_type`, `pay_type`, `status`, `issue_pic`, `updated_at`, `created_
Time of Update: 2015-11-17
標籤:網上都巨坑 最後在官網找到了開啟方法 原來是設定檔改了Updated example for 2015 MySQL 5.6:slow_query_log = 1slow_query_log_file = /var/log/mysql/slow.loglong_query_time = 10log_queries_not_using_indexes = 1Change permissions so that mysqld can write to the specified log
Time of Update: 2015-11-16
標籤:需要知道sql中關鍵字的執行順序。FROM-> ON->JOIN-> WHERE->GROUP BY-> HAVING->SELECT-> DISTINCT->ORDER
Time of Update: 2015-11-18
標籤:當我們去設計資料庫表結構,對操作資料庫時(尤其是查表時的SQL語句),我們都需要注意資料操作的效能。這裡,我們不會講過多的SQL語句的最佳化,而只是針對MySQL這一Web應用最多的資料庫。希望下面的這些最佳化技巧對你有用。 1. 為查詢快取最佳化你的查詢 大多數的MySQL伺服器都開啟了查詢快取。這是提高性最有效方法之一,而且這是被MySQL的資料庫引擎處理的。當有很多相同的查詢被執行了多次的時候,這些查詢結果會被放到一個緩衝中,這樣,後續的相同的查詢就不用動作表而直接存取緩衝結果了。
Time of Update: 2015-11-18
標籤:前言在資料庫中存的就是一張張有著千絲萬縷關係的表,所以表設計的好壞,將直接影響著整個資料庫。而在設計表的時候,我們都會關注一個問題,使用什麼儲存引擎。等一下,儲存引擎?什麼是儲存引擎?什麼是儲存引擎?關聯式資料庫表是用於儲存和組織資訊的資料結構,可以將表理解為由行和列組成的表格,類似於Excel的試算表的形式。有的表簡單,有的表複雜,有 的表根本不用來儲存任何長期的資料,有的表讀取時非常快,但是插入資料時去很差;而我們在實際開發過程中,就可能需要各種各樣的表,不同的表,就意味著存