假設有兩個欄位完全一致的表,table1和table2。欄位分別為password, username, email。則使用UNION(或UNION ALL)進行多表查詢的基本方法就是簡單的串連: SELECT password,username,email FROM table1 where username like '123' UNION ALL //或用UNION以去除重複資料 SELECT
命令列下建立不同字元集的資料庫、刪除資料庫:[root@lamp ~]# /usr/local/mysql/bin/mysql -uroot -p'admin123'Warning: Using a password on the command line interface can be insecure.Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is
修改刪除mysql資料庫中的資料內容:[root@hk ~]# /usr/local/mysql/bin/mysql -uroot -p'admin' #進入mysqlmysql> create database gbk default character set gbk collate gbk_chinese_ci; #建立一個名字叫做gbk的資料庫mysql> use gbkmysql> show databases;+--------------------+|
一、主庫、從庫同步測試[root@Master-Mysql ~]# /usr/local/mysql/bin/mysql -uroot -pmysql> show processlist\G State: Master has sent all binlog to slave; waiting for binlog to be updatedmysql> create database helloworld;mysql> use hitest;mysql>
預設登入mysql之後show variables like ‘%character%’, 出現 mysql》 show variables like ‘%character%’; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+-------------------
MAC系統下的隨機啟動,不僅僅在一個地方常規隨機啟動項目喜好設定–賬戶看圖上一陣因為python的mysql調用,在本地安裝了一個mysql,結果現在每次都隨機啟動,我得手工去停止,再啟動lampp的mysql查了半天發現mac在/Library/StartupItems下還有一大堆檔案其中有個叫MYSQLCOM幸好mac內建了是否隨機啟動的選項vi /etc/hostconfig# This file is going