MySQL5.6新增root使用者報錯:Field 'ssl_cipher' doesn't have a default value
2012.14.15
MySQL: 5.6.19
剛剛忙完了零售測試環境的部署,現在處理上週遺留的問題。
由於user 表中確實localhost和127.0.0.1條目資訊:
這樣導致我在伺服器本地登入的時候,解析的是以 方式登入,然而這種方式登入的root是沒有grant 許可權,這使得不能給其他使用者授權。
解決思路分析:
把缺失的條目新增到user表中。
由於我也是這半年才真正的接觸MySQL。所以很多也是問度娘,我也以為像user表中新增記錄是使用INSERT into。但是這種方法會報錯:
ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value
這是因為user表中有幾個列是非空,而它的預設值是null .
| ssl_cipher | blob | NO | | NULL | |
| x509_issuer | blob | NO | | NULL | |
| x509_subject | blob | NO | | NULL | |
所以一般的insert into 都是給出前三列。而忽視了其他列。這種方式好像是在5.1之前可以使用的。我的是5.6。這種方式就行不通
解決方法:
GRANT USAGE ON *.* TO IDENTIFIED BY '123456' WITH GRANT OPTION;
GRANT USAGE ON *.* TO IDENTIFIED BY '123456' WITH GRANT OPTION;
記得要重新整理一下:flush privileges;
重新登入mysql -uroot -p123456
檢視當前登入使用者和登入的方式:
mysql> select user();
+----------------+
| user() |
+----------------+
| |
+----------------+
1 row in set (0.00 sec)
這樣就可以不走@'%'
還可以修改root @'%'方式的許可權:
MySQL: 5.6.19
剛剛忙完了零售測試環境的部署,現在處理上週遺留的問題。
由於user 表中確實localhost和127.0.0.1條目資訊:
-
mysql> select Host,User,Password from user where User=\'root\';
-
+--------------+------+-------------------------------------------+
-
| Host | User | Password |
-
+--------------+------+-------------------------------------------+
-
| bidevedw\\_db| root | *D013A4E3A5BB01E4239D18D7E93B59B7D2B767AD |
-
| ::1 | root | *D013A4E3A5BB01E4239D18D7E93B59B7D2B767AD |
-
| % | root | *D013A4E3A5BB01E4239D18D7E93B59B7D2B767AD |
- +--------------+------+-------------------------------------------+-
-
*************************** 4. row ***************************
-
Host: %
-
User: root
-
Password: *D013A4E3A5BB01E4239D18D7E93B59B7D2B767AD
-
Select_priv: Y
-
Insert_priv: Y
-
Update_priv: Y
-
Delete_priv: Y
-
Create_priv: Y
-
Drop_priv: Y
-
Reload_priv: Y
-
Shutdown_priv: Y
-
Process_priv: Y
-
File_priv: Y
-
Grant_priv: N
-
References_priv: Y
-
Index_priv: Y
-
Alter_priv: Y
-
Show_db_priv: Y
-
Super_priv: Y
-
Create_tmp_table_priv: Y
-
Lock_tables_priv: Y
-
Execute_priv: Y
-
Repl_slave_priv: Y
-
Repl_client_priv: Y
-
Create_view_priv: Y
-
Show_view_priv: Y
-
Create_routine_priv: Y
-
Alter_routine_priv: Y
-
Create_user_priv: Y
-
Event_priv: Y
-
Trigger_priv: Y
-
Create_tablespace_priv: Y
-
ssl_type:
-
ssl_cipher:
-
x509_issuer:
-
x509_subject:
-
max_questions: 0
-
max_updates: 0
-
max_connections: 0
-
max_user_connections: 0
-
plugin: mysql_native_password
-
authentication_string:
- password_expired: N
把缺失的條目新增到user表中。
由於我也是這半年才真正的接觸MySQL。所以很多也是問度娘,我也以為像user表中新增記錄是使用INSERT into。但是這種方法會報錯:
ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value
這是因為user表中有幾個列是非空,而它的預設值是null .
| ssl_cipher | blob | NO | | NULL | |
| x509_issuer | blob | NO | | NULL | |
| x509_subject | blob | NO | | NULL | |
所以一般的insert into 都是給出前三列。而忽視了其他列。這種方式好像是在5.1之前可以使用的。我的是5.6。這種方式就行不通
解決方法:
GRANT USAGE ON *.* TO IDENTIFIED BY '123456' WITH GRANT OPTION;
GRANT USAGE ON *.* TO IDENTIFIED BY '123456' WITH GRANT OPTION;
記得要重新整理一下:flush privileges;
重新登入mysql -uroot -p123456
檢視當前登入使用者和登入的方式:
mysql> select user();
+----------------+
| user() |
+----------------+
| |
+----------------+
1 row in set (0.00 sec)
這樣就可以不走@'%'
還可以修改root @'%'方式的許可權:
mysql> GRANT ALL PRIVILEGES ON *.* TO " IDENTIFIED BY "123456" WITH GRANT OPTION;
Query OK, 0 rows affected (0.02 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.03 sec)
你許可權的時候會顯示:Grant_priv: Y
這樣root使用者以@'%'方式就可以做grant操作
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30936525/viewspace-2016595/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default valueError
- 資料庫報錯java.sql.SQLException: Field ‘id‘ doesn‘t have a default value資料庫JavaSQLException
- Field ‘spu_id‘ doesn‘t have a default valu 解決辦法
- 解決pgpool啟動報錯 ifup[/sbin/ip] doesn't have setuid bitUI
- pymysql.err.OperationalError: (1136, “Column count doesn‘t match value count at row 1“)報錯反省。MySqlError
- MySQL 啟動報錯 Table 'mysql.plugin' doesn't existMySqlPlugin
- MySQL 5.7 Invalid default value for 'CREATE_TIME'報錯的解決方法MySql
- 安裝mysql遇到ERROR: 1136 Column count doesn't match value count at row 1MySqlError
- 'mysql.column_stats' doesn't exist and Table 'mysql.index_stats' doesn't existMySqlIndex
- 裝nagios報You don't have permission to access /nagios/ on this server. 錯誤iOSServer
- Can't use function return value in write context 使用empty遇到報錯FunctionContext
- Couldn't be opened because you don't have permission to view it 執行時報錯View
- 使用root使用者啟動hadoop報錯Hadoop
- scrollTop doesn't scroll on Chrome 61Chrome
- C++ doesn't name a typeC++
- mysql手工新增root使用者MySql
- mysql匯入報錯Variable 'sql_notes' can't be set to the value of 'NULL'MySqlNull
- Linux環境下MySQL報Table 'xxx' doesn't exist錯誤解決方法LinuxMySql
- mysql5.6 mysqldump備份報錯MySql
- 函式引數的 Default value函式
- Your default context=root:system_r:unconfined_t:SystemLow-SystemHighContext
- Access denied for user 'default'@'%' to database 'shop'報錯Database
- MySQL 5.5原始碼安裝時啟動資料庫報錯"Table 'mysql.user' doesn't exist??"MySql原始碼資料庫
- [php排錯] Forbidden You don't have permission to access / on this server.PHPORBServer
- Ubuntu-給新增使用者新增root許可權Ubuntu
- doesn't contain a valid partition tableAI
- Solaris 5.8 CRON doesn't work with regular user
- [BUG反饋]子查詢報錯,Base table or view not found: 1146 Table 'onethink.(' doesn't existView
- MySQL查詢報錯:ERROR 1146 (42S02): Table 'craw.sitePageConfig' doesn't existMySqlError
- You have new mail in /var/spool/mail/rootAI
- wget下載安裝時出現錯誤doesn‘t match requested host name錯誤wget
- about Res folder doesn't exist in android projectAndroidProject
- oracle 匯入報錯:field in data file exceeds maximum lengthOracle
- 新建使用者並將使用者新增到root使用者組內
- d3d11 effect state and default value tables3D
- 網站提示:You Don’t Have Permission To Access網站
- React報錯之Function components cannot have string refsReactFunction
- 給非 root 使用者新增 docker 使用許可權Docker