預設安裝的mysql資料庫,無法遠端連線。
登入mysql之後,執行
select user,host from mysql.user;
如果只有一條記錄,說明是這個原因。
將下面的指令碼儲存成user.sql,登入mysql,執行:
use mysql;
source user.sql;
flush privileges;
notice: 會重置mysql user表,並且將root使用者密碼設定為空。
指令碼內容:
set foreign_key_checks=0;
-- ----------------------------
-- table structure for `user`
-- ----------------------------
use mysql;
drop table if exists `user`;
create table `user` (
`host` char(60) collate utf8_bin not null default '',
`user` char(16) collate utf8_bin not null default '',
`password` char(41) character set latin1 collate latin1_bin not null default '',
`select_priv` enum('n','y') character set utf8 not null default 'n',
`insert_priv` enum('n','y') character set utf8 not null default 'n',
`update_priv` enum('n','y') character set utf8 not null default 'n',
`delete_priv` enum('n','y') character set utf8 not null default 'n',
`create_priv` enum('n','y') character set utf8 not null default 'n',
`drop_priv` enum('n','y') character set utf8 not null default 'n',
`reload_priv` enum('n','y') character set utf8 not null default 'n',
`shutdown_priv` enum('n','y') character set utf8 not null default 'n',
`process_priv` enum('n','y') character set utf8 not null default 'n',
`file_priv` enum('n','y') character set utf8 not null default 'n',
`grant_priv` enum('n','y') character set utf8 not null default 'n',
`references_priv` enum('n','y') character set utf8 not null default 'n',
`index_priv` enum('n','y') character set utf8 not null default 'n',
`alter_priv` enum('n','y') character set utf8 not null default 'n',
`show_db_priv` enum('n','y') character set utf8 not null default 'n',
`super_priv` enum('n','y') character set utf8 not null default 'n',
`create_tmp_table_priv` enum('n','y') character set utf8 not null default 'n',
`lock_tables_priv` enum('n','y') character set utf8 not null default 'n',
`execute_priv` enum('n','y') character set utf8 not null default 'n',
`repl_sl**e_priv` enum('n','y') character set utf8 not null default 'n',
`repl_client_priv` enum('n','y') character set utf8 not null default 'n',
`create_view_priv` enum('n','y') character set utf8 not null default 'n',
`show_view_priv` enum('n','y') character set utf8 not null default 'n',
`create_routine_priv` enum('n','y') character set utf8 not null default 'n',
`alter_routine_priv` enum('n','y') character set utf8 not null default 'n',
`create_user_priv` enum('n','y') character set utf8 not null default 'n',
`event_priv` enum('n','y') character set utf8 not null default 'n',
`trigger_priv` enum('n','y') character set utf8 not null default 'n',
`ssl_type` enum('','any','x509','specified') character set utf8 not null default '',
`ssl_cipher` blob not null,
`x509_issuer` blob not null,
`x509_subject` blob not null,
`max_questions` int(11) unsigned not null default '0',
`max_updates` int(11) unsigned not null default '0',
`max_connections` int(11) unsigned not null default '0',
`max_user_connections` int(11) unsigned not null default '0',
primary key (`host`,`user`)
) engine=myisam default charset=utf8 collate=utf8_bin comment='users and global privileges';
-- ----------------------------
-- records of user
-- ----------------------------
insert into `user` values ('localhost', 'root', '', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', '', '', '', '', '0', '0', '0', '0');
insert into `user` values ('127.0.0.1', 'root', '', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', '', '', '', '', '0', '0', '0', '0');
insert into `user` values ('%', 'root', '', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', 'y', '', '', '', '', '0', '0', '0', '0');
flush privileges;
引數初始化表
成員初始化表的作用如下 成員初始化錶用在類的建構函式中,對類的資料成員等初始化。其實它的作用還不僅如此。class a public a int a,int b x a y b 這就是成員初始化表 private int x int y class b public b int c private ...
鍊錶初始化
include include include struct node void init node plink int create node plink int insert node plink int print node plink int main void init node plin...
初始化 指定初始化
id alloc 物件的誕生過程,主要是從作業系統獲得一塊足夠大的記憶體,以存放該類的全部例項變數,並將其指定為存放記憶體物件的實力變數的位置。alloc方法同時將這塊記憶體全部設定為0。結果是 bool變數初始化為no,所有的int型別變數為0,float變數為0.0,所有的指標為nil.obje...