先用root登陆mysql,然后运行下面代码创建mysql用户和库
下面创建的帐号:test123 密码:123456 库名:test123
CREATE USER 'test123'@'localhost' IDENTIFIED BY '123456'; GRANT USAGE ON * . * TO 'test123'@'localhost' IDENTIFIED BY '123456' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ; CREATE DATABASE IF NOT EXISTS `test123` ; GRANT ALL PRIVILEGES ON `test123` . * TO 'test123'@'localhost';
mysql root密码忘记修改方法参考:http://www.cnblogs.com/kangleweb/p/9364711.html