Time of Update: 2018-12-08
在MySQL中,使用While語句迴圈與SQL Server中有所不同,代碼測試通過。 MSSQL中使用while語句迴圈產生資料的方法: 範例程式碼: 複製代碼 代碼如下:declare @a int set @a = 1 while @a<25 begin INSERT INTO demotable (id,item1,item2) VALUES (@a,"abc","123") set @a = @a + 1 end MySQL中,使用while迴圈處理資料方法:需要建立為預存程序,
Time of Update: 2018-12-08
1、首先停止正在啟動並執行MySQL進程 Linux下,運行 killall -TERM mysqld Windows下,如果寫成服務的 可以運行:net stop mysql,如未載入為服務,可直接在進程管理器中進行關閉。 2、以安全模式啟動MySQL Linux下,運行 /usr/local/mysql/bin/mysqld_safe –skip-grant-tables & Windows下,在命令列下運行 X:/MySQL/bin/mysqld-nt.exe
Time of Update: 2018-12-08
安裝環境 centos 5.4 mysql 5.1.xx 採用rpm直接安裝 xtrabackup 1.2.22 採用rpm直接安裝 複製代碼 代碼如下:[mysqld] server-id = 1 log-bin innodb_flush_log_at_trx_commit=1 sync_binlog=1 datadir=/var/lib/mysql character-set-server=utf8 init_connect='SET NAMES utf8'
Time of Update: 2018-12-08
今天在我的虛擬機器中布置了環境,測試抓圖如下:抓的這幾個都是第一次執行的,刷了幾次後,取平均值,效率大致相同,而且如果在一個列上同時建唯一索引和普通索引的話,mysql會自動選擇唯一索引。Google一下:唯一索引和普通索引使用的結構都是B-tree,執行時間複雜度都是O(log
Time of Update: 2018-12-08
通常來說,在MyISAM裡讀寫操作是串列的,但當對同一個表進行查詢和插入操作時,為了降低鎖競爭的頻率,根據concurrent_insert的設定,MyISAM是可以平行處理查詢和插入的: 當concurrent_insert=0時,不允許並發插入功能。 當concurrent_insert=1時,允許對沒有洞洞的表使用並發插入,新資料位元於資料檔案結尾(預設)。 當concurrent_insert=2時,不管表有沒有洞洞,都允許在資料檔案結尾並發插入。
Time of Update: 2018-12-08
我的個人實踐是:phpmyadmin 匯出 utf-8 的 insert 模式的 abc.sql ftp abc.sql 到伺服器 ssh 到伺服器 mysql -u abc -p use KKK(資料庫名,如果沒有就 create database KKK) set names 'utf8' source abc.sql 注意:我看到 set character set utf8; 的說法,那樣不行,中文亂碼。 1.首先在命令列控制台中開啟mysql 或許命令的如下: mysql -u
Time of Update: 2018-12-08
使用MySQL Administrator 登入,報錯: Either the server service or the configuration file could not be found.Startup variable and service section are there for disabled. 使用Root 登入進去以後看到管理功能都是禁止掉的,提示: This section is only avaliable when connected to localhost
Time of Update: 2018-12-08
MySQL 查詢in操作,查詢結果按in集合順序顯示 複製代碼 代碼如下:select * from test where id in(3,1,5) order by find_in_set(id,'3,1,5'); select * from test where id in(3,1,5) order by substring_index('3,1,2',id,1);偶爾看到的。。。或許有人會注意過,但我以前真不知道 SQL: select * from table where id IN (
Time of Update: 2018-12-08
1.由於設定了slave的配置資訊,mysql在資料庫data目錄下產生master.info,所以如有要修改相關slave的配置要先刪除該檔案,否則修改的配置不能生效。 提示:如果修改了主伺服器的配置,記得刪除從伺服器上的master.info檔案。否則從伺服器使用的還是老配置,可能會導致錯誤。 2.停止資料庫服務,並且刪除當前的所有mysql日誌(預設是mysql-bin.*) 3.把從伺服器的同步處理記錄刪除(預設是mysql-relay-bin.*)
Time of Update: 2018-12-08
複製代碼 代碼如下:<?php /* MYSQL 資料庫訪問封裝類 MYSQL 資料訪問方式,php4支援以mysql_開頭的過程訪問方式,php5開始支援以mysqli_開頭的過程和mysqli物件導向 訪問方式,本封裝類以mysql_封裝 資料訪問的一般流程: 1,串連資料庫 mysql_connect or mysql_pconnect 2,選擇資料庫 mysql_select_db 3,執行SQL查詢 mysql_query 4,處理返回的資料 mysql_fetch_array
Time of Update: 2018-12-08
CentOS linux由於同時具有與RHEL的相容性和企業級應用的穩定性,又允許使用者自由使用,因此得到了越來越廣泛的應用。 1]CentOS mysql安裝解壓 [root@localhost root]# cd /usr/local/mysql/software [root@localhost software]# ls mysql-4.0.16.tar.gz [root@localhost software]#tar zxvf mysql-4.0.16.tar.gz 2]CentOS
Time of Update: 2018-12-08
Fedora5下配置MySQL (很有參考價值的 MySQL資料 包括如何在linux檔案系統移動MySQL資料庫的位置) 一、下載MySQL安裝檔案 完整安裝MySQL需要下面6個檔案: MySQL-server-community-5.1.26-0.rhel4.i386.rpm MySQL-client-community-5.1.26-0.rhel4.i386.rpm MySQL-shared-community-5.1.26-0.rhel4.i386.rpm
Time of Update: 2018-12-08
1、MySQL常用命令 create database name; 建立資料庫 use databasename; 選擇資料庫 drop database name 直接刪除資料庫,不提醒 show tables; 顯示表 describe tablename; 表的詳細描述 select 中加上distinct去除重複欄位 mysqladmin drop databasename 刪除資料庫前,有提示。 顯示當前mysql版本和當前日期 select
Time of Update: 2018-12-08
使用軟體:MySQLMigrationTool 提示資料過大,無法匯入。修改my.cnf檔案的max_allowed_packet = 100M以上。在windows作業系統中,my.cnf有可能顯示不出來,需要用編輯器直接輸入地址:盤符:\目錄mysql教程binmy.cnf開啟。 “there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE
Time of Update: 2018-12-08
複製代碼 代碼如下:<?php $cfg_dbhost ='localhost';//mysql主機 $cfg_dbname ='sq_test';//資料庫名 $cfg_dbuser ='root';//資料庫使用者名稱 $cfg_dbpwd ='jb51.net';//資料庫使用者密碼 $cfg_db_language ='utf8';//資料庫編碼 class dbmysql{ public static $dbhost = 'localhost'; public static
Time of Update: 2018-12-08
這裡的分表邏輯是根據t_group表的user_name組的個數來分的。因為這種情況單獨user_name欄位上的索引就屬於爛索引。起不了啥名明顯的效果。1、實驗PROCEDURE.DELIMITER $$DROP PROCEDURE `t_girl`.`sp_split_table`$$CREATE PROCEDURE `t_girl`.`sp_split_table`()BEGIN declare done int default 0; declare v_user_name
Time of Update: 2018-12-08
MySQL的內建引擎肯定是夠用了,但是在有些情況下,其他的引擎可能要比手頭所用更適合完成任務。如果願意的話,你甚至可以使用MySQL++ API來建立自己的資料庫引擎,就像打穿氣缸裝上自己的化油器。現在讓我們來看看你該如何選擇引擎,以及如何在可用引擎之間切換。 選擇你的引擎
Time of Update: 2018-12-08
Php http://windows.php.net/downloads/releases/php-5.3.1-Win32-VC9-x86.zip Apache http://apache.freelamp.com/httpd/binaries/win32/apache_2.2.14-win32-x86-openssl-0.9.8k.msi Mysql http://mysql.mirror.tw/Downloads/MySQL-5.5/mysql-5.5.0-m2-win32.msi 1.
Time of Update: 2018-12-08
1303-Can 't create a PROCEDURE from within another stored routine. 這個錯誤資訊,比較難以理解,於是仔細檢查預存程序內容,也沒什麼問題呀,代碼如下: 複製代碼 代碼如下:CREATE PROCEDURE addData() begin declare v int default 0; while v < 4000000 do insert into TestMemory values
Time of Update: 2018-12-08
下面是一種實現的方法。思路就是想辦法在觸發器中利用一個出錯的語句來中斷代碼的執行。 mysql> create table t_control(id int primary key); Query OK, 0 rows affected (0.11 sec) mysql> insert into t_control values (1); Query OK, 1 row affected (0.05 sec) mysql> create table