How to reset the password of root on mysql

Just as what the title tells, this article aims to record how to reset the password of mysql for root user.

Check the potential risks

First, Due to there is going to be a period of time that the mysql is available without needing authentication, it will be very dangerous. So the best way to do such a risky thing is to plug the network cable out of the server to isolate it from the outer nerwork space.

Add skip-authentication parameter

vi /etc/my.cnf
Add ‘skip-grant-tables’
[mysqld]
datadir = /var/lib/mysql
socket=/var/lib/mysql/mysql.sock
skip-grant-tables

save it and exit vi

restart mysqld

#/etc/init.d/mysqld restart
And it will show this message:
Stopping MySQL: [ OK ]
Starting MySQL: [ OK ]

Log On and modify the password

# /usr/bin/mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 to server version: 3.23.56 Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> USE mysql ; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> UPDATE user SET Password = password ( 'new-password' ) WHERE User = 'root' ; Query OK, 0 rows affected (0.00 sec) Rows matched: 2 Changed: 0 Warnings: 0 mysql> flush privileges ; Query OK, 0 rows affected (0.01 sec) mysql> \q Bye

Delete ‘skip-grant-tables’ and restart mysqld

And all done.

Refer:

linux下mysql的root密码忘记解决方法

Philosophy of python

Today, I have known that if we type import this in python command line, and it will show as following:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!

And this is the philosophy of python developing, the idioms are quite meaningful and interesting. So I made a copy to remind myself to follow these principles when developing softwares or coding XD.

How to repair the EFI Bootloader in Windows 10

Recently, I reinstalled my OS because of some tough problems. When I installed Fedora, I though I should format the formal configured partitions to make it clean to install the entirely new OS, Fedora 22. But it’s the source of the following problems, I carelessly delete my EFI partition! I thought the /boot/efi partition is what fedora created alone and it’s no sense with my formally installed Windows system. However, the truth proves that I am wrong, the Fedora just merge its files into EFI partition with my primary OS Windows 10 Pro, so, I deleted the partition that containing the files that what windows boots needs.

A Small C game(snippet)

A few days ago my friend asked me to write a small project based on C/CPP to help him finish his short-term training’s task, for example, student management system, shopping mall management system, and so on. I told him that I am not able to finish such a big project on my own because my lacking of computing programming skills. And he told me “easy~just relax and give me a small code snippet, just about 300-500 lines.” Quite a big problem for me.

How to install BCM4322 wlan drive for Fedora 22

Last week I installed Fedora 22 again to avoid some conflictions due to I
had installed some weird software and configure some environments incorrectly. But then I faced a difficult problem, the wireless network interface card didn’t work! And to tell you the truth, it was not the first time that I had encountered with such a … problem, I just can not describe such a situation…It’s a little funny, cuz it’s not my laptop’s original NIC. Some weeks ago or even more earlier, I tried to install MAC OS X 11.10 onto my laptop(Lenovo Y510P) and the wireless NIC is not compatible with MAC OS X, that is to say, Apple has not released a drive for OS X to drive it. So I changed it to make it possible to be accessable to the internet. To bypass some strange problems, I choose Broadcom 4322M, a NIC that do not need a drive to work correctly, yeah, it’s natively supported by OS X. However, I have never expected it will be so hard for Fedora 22 to drive it and make it works correctly and smoothly.

How to set up a private git repository on CentOS

Recently I’ve received a task of set up a private git repository on the team’s ECS(Aliyun) which is based on CentOS 6.5. I was wondering how to set up such a git repository easily and efficiently, due to as to my team, it is too expensive for us to afford Github private repository ($7.00/month). And however, the powerful control of authority is not that necessary for our such a little team(5 people). Therefore, it will be much more clever to set up a git repository on our own VPS.

加载失败,请尝试使用下方导航