简体   繁体   中英

Unable to login to MySQL instance hosted on AWS ec2

I am trying to set up a mysql database on an aws ec2 instance (SUSE 32-bit with mysql pre-installed). However, I can't log in to mysql as root user:

mysql -u root
Access denied

without a password, so is there a way of getting one? I believe that root user is blocked and hence should login with ec2-user . However, when I do

mysql -u ec2-user

the user does not have the priviledges to create a database.

I'm a not very familiar with linux, so if I'm simply doing this completely wrong, then do say.

Any help would be greatly appreciated.

The fact that this server is on EC2 is irrelevant. SUSE and MySQL do not know this. Amazon cannot block anything, you have root access to the server. You recover/change the root password the same as any server, with mysqladmin, or by starting mysqld with --skip-grant-tables while you make the change.

mysql -u root -p

然后按Enter。

I know, this isn't a direct answer to your question, but I would recommend using the AWS Relational Database Service. Amazon will host a MySQL database for you and take care of all the setup, maintenance, scaling, backup, etc.

http://aws.amazon.com/rds/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM