I'm getting an error: mysqladmin.exe: connect to server at 'localhost' failed error: 'Access denied for user 'ODBC'@'localhost' (using password: YES)'
我有一个错误:mysqladmin。exe:在“localhost”失败错误中连接到服务器:“访问拒绝为用户的ODBC”@“localhost”(使用密码:YES)
I tried to grant privileges
我试图给予特权。
mysqladmin.exe grant all ON *.* TO 'myuser'@'localhost'
I'm trying to create a database with:
我尝试创建一个数据库
CD C:\Program Files\MySQL\MySQL Server 5.5\bin
mysqladmin.exe create database comersus -p
I just installed MySQL 5.5.27.2 I created a user called myuser I'm working in XP Pro sp3
我刚安装了MySQL 5.5.27.2,我创建了一个名为myuser的用户,我在XP Pro sp3中工作。
Please let me know the correct command line to (I think I need to grant permission first) Create a database file.
请让我知道正确的命令行(我认为我需要先授予权限)创建一个数据库文件。
4 个解决方案
#1
13
Try running the mysql command with the following option:
尝试使用以下选项运行mysql命令:
C:> mysql -u root
This specifies the "root" MySQL user when you connect.
这将在连接时指定“根”MySQL用户。
Because you didn't specify any user, it defaulted to an "anonymous" (unnamed) user. On Windows, the username is set to "ODBC" for some reason unknown to me.
因为没有指定任何用户,所以默认为“匿名”(匿名)用户。在Windows上,用户名被设置为“ODBC”,原因不明。
Read this page (part of the tutorial) about connecting to the server.
阅读这一页(教程的一部分)关于连接到服务器。
And read the section of the docs starting at the link below, to learn more than you ever thought possible about users and privileges.
阅读下面链接的文档部分,了解更多关于用户和特权的信息。
#2
1
I was able to create a database, Grant permissions and flush privileges to activate the new permissions in a batch file:
我能够创建一个数据库,授予权限和刷新特权,以激活批处理文件中的新权限:
Start of MySQLrun.bat
开始MySQLrun.bat
@echo off
:: I had to use the root user because the user I created didn't have any authority
set user=root
::set user=MyUser
:: When I first installed MySQL I set a password
set password=MyPassword
set host=localhost
CD C:\Program Files\MySQL\MySQL Server 5.5\bin
:: Create a database file
:: The log will be in C:\Program Files\MySQL\MySQL Server 5.5\bin
mysql -h %host% -u %user% -p%password% < c:\Dnload\MySQLCommands.sql --tee=Run.log --comments --debug-info --verbose
cmd
End of MySQLrun.bat
年底MySQLrun.bat
The bat file runs the commands in the MySQLCommands.sql file:
bat文件在MySQLCommands中运行命令。sql文件:
Start of MySQLCommands.sql
开始MySQLCommands.sql
drop database if exists MyDatabaseFileName;
CREATE DATABASE MyDatabaseFileName;
# An example of how to GRANT ALL privileges to a user
#grant all ON mydatabasefilename.* TO 'Myuser'@localhost identified by 'MyPassword';
# GRANT INSERT, DELETE, UPDATE, SELECT ON databasename.* TO ‘username’@'localhost’ IDENTIFIED BY ‘password’;
# To activate the new permissions, issue the following command:
FLUSH PRIVILEGES;
# How to log in to a specific database on a MySQL server:
show grants for 'MyUser'@'localhost'
End of MySQLCommands.sql
年底MySQLCommands.sql
Please Note: All usernames, Database names and passwords are case sensitive.
请注意:所有用户名、数据库名和密码都是大小写敏感的。
There are many ways to create a database. This is just one of them.
创建数据库的方法有很多。这只是其中之一。
#3
1
My case was a dumb mistake I typed mysql u -jim -p
我的例子是一个愚蠢的错误,我输入了mysql u -jim -p。
#4
1
I got the same issue and find my solution.
我遇到了同样的问题,找到了解决办法。
Go to path MySQL/data. Under this folder check for (.err) ERR file. There may be temporary password generated as below.
去路径MySQL /数据。在此文件夹下检查(. ERR) ERR文件。可能会产生以下临时密码。
[Note] A temporary password is generated for root@localhost: _yJU=h0P!E<0
[注意]root@localhost: _yJU=h0P!E<0,生成临时密码。
Hope it helps some one.
希望它能帮助一些人。
#1
13
Try running the mysql command with the following option:
尝试使用以下选项运行mysql命令:
C:> mysql -u root
This specifies the "root" MySQL user when you connect.
这将在连接时指定“根”MySQL用户。
Because you didn't specify any user, it defaulted to an "anonymous" (unnamed) user. On Windows, the username is set to "ODBC" for some reason unknown to me.
因为没有指定任何用户,所以默认为“匿名”(匿名)用户。在Windows上,用户名被设置为“ODBC”,原因不明。
Read this page (part of the tutorial) about connecting to the server.
阅读这一页(教程的一部分)关于连接到服务器。
And read the section of the docs starting at the link below, to learn more than you ever thought possible about users and privileges.
阅读下面链接的文档部分,了解更多关于用户和特权的信息。
#2
1
I was able to create a database, Grant permissions and flush privileges to activate the new permissions in a batch file:
我能够创建一个数据库,授予权限和刷新特权,以激活批处理文件中的新权限:
Start of MySQLrun.bat
开始MySQLrun.bat
@echo off
:: I had to use the root user because the user I created didn't have any authority
set user=root
::set user=MyUser
:: When I first installed MySQL I set a password
set password=MyPassword
set host=localhost
CD C:\Program Files\MySQL\MySQL Server 5.5\bin
:: Create a database file
:: The log will be in C:\Program Files\MySQL\MySQL Server 5.5\bin
mysql -h %host% -u %user% -p%password% < c:\Dnload\MySQLCommands.sql --tee=Run.log --comments --debug-info --verbose
cmd
End of MySQLrun.bat
年底MySQLrun.bat
The bat file runs the commands in the MySQLCommands.sql file:
bat文件在MySQLCommands中运行命令。sql文件:
Start of MySQLCommands.sql
开始MySQLCommands.sql
drop database if exists MyDatabaseFileName;
CREATE DATABASE MyDatabaseFileName;
# An example of how to GRANT ALL privileges to a user
#grant all ON mydatabasefilename.* TO 'Myuser'@localhost identified by 'MyPassword';
# GRANT INSERT, DELETE, UPDATE, SELECT ON databasename.* TO ‘username’@'localhost’ IDENTIFIED BY ‘password’;
# To activate the new permissions, issue the following command:
FLUSH PRIVILEGES;
# How to log in to a specific database on a MySQL server:
show grants for 'MyUser'@'localhost'
End of MySQLCommands.sql
年底MySQLCommands.sql
Please Note: All usernames, Database names and passwords are case sensitive.
请注意:所有用户名、数据库名和密码都是大小写敏感的。
There are many ways to create a database. This is just one of them.
创建数据库的方法有很多。这只是其中之一。
#3
1
My case was a dumb mistake I typed mysql u -jim -p
我的例子是一个愚蠢的错误,我输入了mysql u -jim -p。
#4
1
I got the same issue and find my solution.
我遇到了同样的问题,找到了解决办法。
Go to path MySQL/data. Under this folder check for (.err) ERR file. There may be temporary password generated as below.
去路径MySQL /数据。在此文件夹下检查(. ERR) ERR文件。可能会产生以下临时密码。
[Note] A temporary password is generated for root@localhost: _yJU=h0P!E<0
[注意]root@localhost: _yJU=h0P!E<0,生成临时密码。
Hope it helps some one.
希望它能帮助一些人。