標籤:資料庫基本指令碼CREATE TABLE `a` (`ID` INT(10) NULL DEFAULT NULL,`class` INT(10) NULL DEFAULT NULL,`score` INT(10) NULL DEFAULT NULL)COLLATE=‘utf8_general_ci‘ENGINE=InnoDB;insert into a values (1,1,110);insert into a values (2,1,120);insert into a values
標籤:一、DCL語句(資料控制語句)1、授權遠端存取,針對IP和使用者、DB的grant {privilege list} on {dbname}.* to ‘{user}‘@‘{ip}‘ identified by ‘{pwd}‘ with grant optionex: grant all privilege on *.* to ‘root‘@‘%‘ identified by ‘***‘ with grant option; -- %代表所有IPgrant all privileges
標籤:出現這種情況應該是在跑業務的時候,mysql資料庫異常中斷導致表異常,查看mysql日誌報錯如下[[email protected] opt]# tail -n 5/var/log/mysqld.log 16082713:29:33[ERROR]/usr/libexec/mysqld:Table‘./ivr/T_CDR‘ is marked as crashed and should be repaired16082713:29:40[ERROR]/usr/libexec/
標籤:原文地址:http://www.linuxbrigade.com/back-up-all-of-your-mysql-databases-nightly/Put the following into something like /usr/local/bin/mysql_backup.sh and since it has MySQL’s root password in it, make sure that you chmod 700 to it so no one
標籤:mysql下面是常用mysql資料庫查詢總結:顯示一個資料表的所有資料。mysql> SELECT * FROM [table name];返回指定資料表的各列資訊。mysql> show columns from [table name];使用值“blog”過濾顯示選定的某些行。mysql> SELECT * FROM [table name] WHERE user = "blog";顯示所有包含name為”Bob”和phone
標籤:mysql查看儲存引擎:mysql> show engines;查看innodb引擎有關所有變數:mysql> show VARIABLES LIKE "%innodb%";mysql> SHOW VARIABLES;設定每個表獨立使用一個資料表空間[[email protected] ~]# echo "innodb_file_per_table = 1" >>/etc/my.cnf重啟生效:[[email protected] ~]#
標籤:mysql本機存取權限:mysql> GRANT ALL PRIVILEGES ON *.* TO ‘username‘@‘localhost‘ IDENTIFIED BY ‘password‘;遠端存取許可權:mysql> GRANT ALL PRIVILEGES ON *.* TO ‘username‘@‘%‘ IDENTIFIED BY ‘password‘;FLUSH PRIVILEGES;增加使用者 test1 密碼