When trying to access the serial console on AWS, I got the following error: Cannot open access to console, the root account is locked Since I had edited /etc/fstab, the host would not boot. The only way to fix this problem is to unmount the root volume from the affected instance, mount it on another […]
mysql>update mysql.user set Password=PASSWORD('secret')where user='root';
mysql>flush privileges;
mysql>^D
service mysql stop
service mysql start
~OR~
service mysqld stop
service mysqld start
For MySQL 5.7: https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html For some other v5.7 nodes, I had admin access via a different user’s login, so all I needed was this:
1
2
ALTER USER'root'@'localhost'IDENTIFIED BY'secret';
All credit to Matt Wilcox for this excellent article, for which this post is based – thank you, Matt! https://mattwilcox.net/web-development/unexpected-ddos-blocking-china-with-ipset-and-iptables/ All commands run as root!
1
2
3
4
yum install-yipset
vi blockchina(see below forcontents)
chmod755blockchina
./blockchina
Do this once only:
1
iptables-AINPUT-ptcp-mset--match-set china src-jDROP;service iptables save
Then add blockchina to the root cron
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh
#
# blockchina
#
DIR=/etc
# Create the ipset list
ipset-Nchina hash:net
# remove any old list that might exist from previous runs of this script
Launch System Preferences Select Users & Groups Select Login Options Select Join next to Network Account Server Select Open Directory Utility Click the lock and enter your password to make changes In the menu bar of Directory Utility, select Change Root Password Create a strong, unique password
Using mysqladmin on the command line If you have never set a root password for MySQL server, the server does not require a password at all for connecting as root.
1
2
$mysql-uroot
mysql>
To set the root password for the first time, use mysqladmin:
1
$mysqladmin-uroot password'NewPasswordHere'
However, if you want to change (or update) a root password, then […]
In the Terminal application, type the following: sudo /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder Then, click on an empty spot on your desktop – NOT in an existing Finder window. Now, type Command-N or select New Finder Window from the File menu. To end your root Finder session, type ^C in the Terminal window. Notes: You won’t be able to […]
erics@zeus:/Users/erics # ssh -i foo.pem ec2-user@thehost.foo Last login: Tue Nov 19 20:28:19 2013 from foo.bar __| __|_ ) _| ( / Amazon Linux AMI ___|\___|___| https://aws.amazon.com/amazon-linux-ami/2013.09-release-notes/ No packages needed for security; 7 packages available Run “sudo yum update” to apply all updates. [ec2-user@xyz ~]$ sudo su […]