linux系統中:mysql進入的命令為mysql -u root -p +你的mysql密碼。
mysql是如何新增使用者呢?
在mysql命令列下,使用use mysql;進入mysql的資料庫中。然後插入資訊到user表,就可以新增上使用者了。
例子如下:
mariadb [mysql]> insert into user (host,user,password,select_priv,insert_priv,update_priv) values ('localhost','whr',password('whr123'),'y','y','y');
query ok, 1 row affected, 4 warnings (0.00 sec)
mariadb [mysql]> select host,user,password from user;
常用的管理mysql的命令:use 資料庫;(進入資料庫)
mariadb [(none)]>use mysql;
database changedshow databases;(檢視mysql中的所有資料庫)
mariadb [(none)]> show databases;
| database |
| information_schema |
| mysql |
| performance_schema |
| test |
4 rows in set (0.01 sec)
show tables;(檢視當前資料庫中的所有表)
mariadb [mysql]> show tables ;
| tables_in_mysql |
| columns_priv |
| db |
| event |
| func |
| general_log |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| host |
| ndb_binlog_index |
| plugin |
| proc |
| procs_priv |
| proxies_priv |
| servers |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
24 rows in set (0.00 sec)
show columnns form 表名;(顯示指定表的屬性)
mariadb [mysql]> show columns from servers;
| field | type | null | key | default | extra |
| server_name | char(64) | no | pri | | |
| host | char(64) | no | | | |
| db | char(64) | no | | | |
| username | char(64) | no | | | |
| password | char(64) | no | | | |
| port | int(4) | no | | 0 | |
| socket | char(64) | no | | | |
| owner | char(64) | no | | | |
9 rows in set (0.00 sec)
show index from 表名;(顯示指定表的詳細索引資訊,包括主鍵)
mariadb [mysql]> show index from user;
| table | non_unique | key_name | seq_in_index | column_name | collation | cardinality | sub_part | packed | null | index_type | comment | index_comment |
| user | 0 | primary | 1 | host | a | null | null | null | | btree | | |
| user | 0 | primary | 2 | user | a | 7 | null | null | | btree | | |
2 rows in set (0.00 sec)
自強學堂mysql MySQL 管理
mysql 管理 啟動及關閉 mysql 伺服器 首先,我們需要通過以下命令來檢查mysql伺服器是否啟動 ps ef grep mysqld 如果mysql已經啟動,以上命令將輸出mysql程序列表,如果mysql未啟動,你可以使用以下命令來啟動mysql伺服器 root host cd usr ...
MySQL MySQL資料管理DML 資料庫02
alter table 表 add constraint 約束名 foreign key 作為外健的列 references 那個表 哪個字段 物理外健,不建議使用 避免資料庫過多造成困擾 最佳實踐 資料庫就是單純的表,只要用存資料 想使用多張表的資料,想使用外健用業務邏輯解決 insert int...
我們的管理 戰略管理
我們的管理 戰略管理 一 戰略聚焦 我個人認為乙個優秀的戰略管理需要三個核心要素 客戶聚焦 配套組織 流程 績效 執行推進與管控。我們的戰略就是這麼做的。首先我們不會一股腦什麼客戶群都不分就一套產品一套打法來應對。我們的客戶戰略就是聚焦行業500強客戶,做高階全面解決方案。這也就意味著我們的品牌 定...