下列可以将mysql的本地root用户的密码修改为‘123’的是()
A: setpasswordforroot@'localhost'=password('123');
B: updatemysql.usersetpassword=password('123')whereuser='root'andhost='localhost';
C: selectpasswordforroot@'localhost'=password('123');
D: createuserroot@'localhost'identifiedby'123';
A: setpasswordforroot@'localhost'=password('123');
B: updatemysql.usersetpassword=password('123')whereuser='root'andhost='localhost';
C: selectpasswordforroot@'localhost'=password('123');
D: createuserroot@'localhost'identifiedby'123';
举一反三
- 下面通过UPDATE语句将root用户的密码修改为mypwd2的语句中,正确的是 A: UPDATE mysql.user SET Password=PASSWORD('mypwd2') WHERE User='root' and Host='localhost'; B: UPDATE mysql.users SET Password=PASSWORD('mypwd2') WHERE User='root' and Host='localhost'; C: UPDATE mysql.users SET Password=PASSWORD('mypwd2') WHERE User='root' OR Host='localhost'; D: UPDATE mysql.user SET Password=PASSWORD('mypwd2') WHILE User='root' OR Host='localhost';
- 使用GRANT语句创建用户名为user1、密码为123,并授予该用户对chapter08.student表有查询权限。 下面选项中,能实现上述功能的语句是 A: GRANT SELECT ON chapter08.student FOR 'user1'@'localhost' IDENTIFIED BY '123'; B: GRANT USER SELECT ON chapter08.student TO 'user1'@'localhost' IDENTIFIED BY '123'; C: GRANT USER SELECT ON chapter08.student 'user1'@'localhost' IDENTIFIED BY '123'; D: GRANT SELECT ON chapter08.student TO 'user1'@'localhost' IDENTIFIED BY '123';
- 使用CREATE USER语句创建一个新用户,用户名为user2、密码为123 下面选项中,能实现上述功能的语句是 A: CREATE USER 'user2'@'localhost' IDENTIFIED BY '123'; B: CREATE USER user2@localhost IDENTIFIED BY 123; C: CREATE USER 'user2'@'localhost' IDENTIFIED TO '123'; D: CREATE USER user2@localhost IDENTIFIED TO '123';
- 连接 MySQL 数据库的正确方法是( ) A: mysql_open("localhost","root","root"); B: mysql_connect("localhost","root","root"); C: connect_mysql("localhost","root","root"); D: dbopen("localhost","root","root");
- 现有用户信息表userinfo,表结构如下:id integer 主键,自增长;uname text 用户名;password text 密码。如果想添加用户名为张三,密码为123的用户,下面SQL语句正确的是() A: insert into userinfo(uname,password) values('张三','123'); B: insert into userinfo(uname,password) values(张三,123); C: insert into userinfo values(null,'张三','123'); D: insert into userinfo(password,uname) values('123','张三');