Change SQL Passwords in FreePBX Step by Step

How to Change MySQL passwords: Follow each step in order !

Step 1) mysql -u root –p [ENTER]
Step 2) Enter password: passw0rd [ENTER]

Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 3743 to server version: 5.0.22

Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the buffer.

Step 3) mysql> use mysql; [ENTER]
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
Step 4) mysql> update user set password = PASSWORD(‘NEW_PASSWORD’) where User = ‘asteriskuser’; [ENTER]`
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

Step 5) mysql> grant all privileges on *.* to root@localhost identified by ‘ NEW_PASSWORD ‘ with grant option; [ENTER]
Query OK, 0 rows affected (0.00 sec)

Step 6) mysql> show databases; [ENTER]
+————————+
| Database |
+————————+
| information_schema |
| asterisk |
| asteriskcdrdb |
| mysql |
+————————+
4 rows in set (0.00 sec)

Step 7) mysql> grant all privileges on asteriskcdrdb.* to asteriskuser@localhost; [ENTER]
Query OK, 0 rows affected (0.00 sec)

Step 8) mysql> grant all privileges on asterisk.* to asteriskuser@localhost; [ENTER]
Query OK, 0 rows affected (0.00 sec)

Step 9) mysql> flush privileges; [ENTER]
Query OK, 0 rows affected (0.00 sec)

mysql> exit [ENTER]
Bye

OK THIS PART IS FINISHED!

Next…..

Change default passwords:

To change the FreePBX manager pass, you need to edit two separate files and put in the new password.

Step 10) nano /etc/asterisk/manager.conf [ENTER]

Find ‘secret = amp111’ under the [admin] section. Change ‘amp11’ to your new desired password. CTRL+X followed by ‘Y’ to save and exit.

Now, we need to edit the /etc/amportal.conf to use our new password.

Step 11) nano /etc/amportal.conf [ENTER]

Find the line that says ‘AMPMGRPASS=amp111’ and change the ‘amp11’ to the new password you just set. Also find the line that says ‘dbpass=amp109’ and change the ‘amp109’ to the new password you just set. CTRL+X followed by ‘Y’ to save and exit.

Step 12) service mysqld restart [ENTER]

Step 13) amportal restart [ENTER]

Ready to Rock ‘n’ Roll!

*** NOTE: FreePBX/MySQL does not like having an exclamation point (!) in the password. There may be other special characters that it doesn’t like also.