mysql學習筆記

建立數據庫java

create database dbname CHARSET utf8 collate utf8_general_ci;mysql



mysql字符集相關內容:(字符集,亂碼的根源。)sql

查看當前數據庫的字符集設定:數據庫

root login and execute the following command:安全

show variables like 'collation_%';服務器


1)選定數據庫併發

show variables like 'collation_%';ui

mysql> use twdpmspa

mysql>show variables like 'character_%'code

mysql>show variable like 'collation_%';

2) 上面兩個查詢的結果中,若是有不是utf8的,修改成utf8.修改方式以下:

編輯/etc/my.cnf (或者/etc/my.ini),追加或修正:

[client]
default_character_set=utf8
[mysql]
default_character_set=utf8
[mysqld]
character_set_server=utf8
#設定爲default_character_set=utf8時報錯。


mysql的模式:

嚴格模式:自己對數據庫的數據有嚴格的限制,若是輸入非法數據,數據庫會報異常。

非嚴格模式:可以輸入一下非正常數據,會報警告,不會拋異常。

查看當前的模式:

mysql>select @@sql_mode;


Mysql的NULL轉換: select IFNULL(original, 2value) from table_name.

查看mysql的版本方式:

1)mysql>mysql status

2)#>mysql -v


安裝完後的配置:

如下錯誤:關閉SELinux

Service iptables stop  (關閉防火牆)

Starting MySQL.Manager of pid-file quit without updating file.[FAILED]

 

1)/etc/my.cnf或者/etc/mysql/my.cnf的配置內容

配置項目:

Server Type

Database usage

InnoDB Tablespace

併發鏈接(concurrent connection)

CharacterSet

 

 

啓動mysql服務器

   只能經過root帳戶進行啓動

   >service mysqld start

   >service mysqld stop

修改root用戶的密碼:

      >mysqladmin -u root password 'manager'

登陸mysql客戶端:

   >mysql –u root -pmanager

啓動mysqld的安全模式

/usr/bin/mysqld_safe &

 

關閉mysqld服務

>mysqladmin -uroot shutdown

相關文章
相關標籤/搜索