Changing the MySQL password
Changing the MySQL password
Note: Some distributions that include FreePBX and Asterisk have their own way of managing passwords. If you are new to FreePBX, and are using a distribution that includes FreePBX and Asterisk, you may want to read the instructions that came with your installation package to see if there is a script you should run, or some other mechanism for modifying system passwords.
If you are using the default password, you will see the message:
Warning: You are running freePBX and mysql with the default password
Running with the default password is a bad idea, simply because everyone else in the world knows it, and (if not properly firewalled, etc etc) could potentially connect to your mysql server and do bad things(tm).
Warning: Don't get cute and try to use a password with non-alphabetic or non-numeric characters - things may break in strange ways if you try to use punctuation characters in passwords. Unless you really know what you are doing, stick to numbers and standard alphabetic characters.
Changing the mysql password
There are multiple ways to change the password in mysql.
Using mysql admin
This requires that you know the existing password. From a shell, run:
mysqladmin -u asteriskuser -p password newpass
where asteriskuser is the username (asteriskuser is typically the default username in FreePBX), and newpass is your new password. You will be prompted for the old password interactively.
Using phpMyAdmin
Log into phpMyAdmin, and select Privileges from the main page. From there, select the user you want to edit, and click the edit icon next to their name.
Note on multiple username entries: Note that sometimes there will be multiple user names with different hosts. MySQL identifies users based on the hostname they're connecting from, and allows different passwords for users when they connect from different hosts. Often there is an entry with localhost and another with %. % is a wildcard in MySQL, and means any host in this case. If you have freePBX running on the same machine (which is most likely true) then the localhost entry is a better match than %, so it is the one that will be used. You can usually safely delete the % entry if you're not using it. If you are using a different host, it's better to use that specific host's name or IP than %. See MySQL documentation for more information.
Scroll down to the "change password" section, and enter the new password.
Using SQL
Connect to the mysql interactive shell:
mysql -u username -p
Usually you will use root or another user with administrative privileges as the username.
Run the following SQL command:
SET PASSWORD FOR asteriskuser@localhost=PASSWORD('newpass');
asteriskuser should be the username of the freePBX user. localhost should only be changed if your freePBX and MySQL servers are different machines. Be sure to include quotes around the new password.
type quit to return to the OS shell.
Verifying the password
If you want to be sure that the password has been changed, run:
mysql -u asteriskuser -p
amportal.conf, cdr_mysql.conf, res_mysql.conf
Once the password works, you need to update three files:
- /etc/amportal.conf:
AMPDBUSER=asteriskuser
AMPDBPASS=mypass
- /etc/asterisk/cdr_mysql.conf:
password=mypass
user=asteriskuser
- /etc/asterisk/res_mysql.conf:
dbuser = asteriskuser
dbpass = mypass
Where asteriskuser is the username (asteriskuser is the typical FreePBX default username) and mypass is the changed password.
(Thanks to gstueve for the comment regarding the latter two files.)
Comments
ptemplin7
Sat, 01/26/2008 - 10:52
Permalink
If you have myPHPadmin set change there also
Make sure you update the myPHPadmin module config file for the new password.
/maint/modules/14_myPHPadmin/config.inc.php
Thanks Paris
Paris Templin
www.templincomputing.net
robxnue
Thu, 07/10/2008 - 17:44
Permalink
file missing
Missing this file:
/etc/asterisk/res_mysql.conf
flatpack
Mon, 04/12/2010 - 14:29
Permalink
i have asteriskNOW 1.5.0 and
i have asteriskNOW 1.5.0 and res_mysql.conf file is missing.
http://192.168.1.5/a2billing
fskrotzki
Fri, 07/11/2008 - 10:15
Permalink
sounds like you don't have a
sounds like you don't have a good complete install. res_mysql.conf is placed in the location documented with you install the asterisk-addon's.
If you google res_mysql.conf you'll find a host of information.
agw
Sun, 11/30/2008 - 10:03
Permalink
One more change required in /etc/amportal.conf
At the very bottom of the file you must change the AMPDBPASS as well.
# SERVERINTITLE if set to true, the browser title will be preceded with the server name. default false
SERVERINTITLE=false
AMPDBNAME=asterisk
AMPDBUSER=asteriskuser
AMPDBPASS=CHANGE THIS ONE AS WELL
ASTETCDIR=/etc/asterisk
ASTMODDIR=/usr/lib/asterisk/modules
ASTVARLIBDIR=/var/lib/asterisk
ASTAGIDIR=/var/lib/asterisk/agi-bin
ASTSPOOLDIR=/var/spool/asterisk
ASTRUNDIR=/var/run/asterisk
ASTLOGDIR=/var/log/asterisk
fskrotzki
Mon, 12/01/2008 - 11:26
Permalink
The editing of this value is
The editing of this value is mentioned in the initial post (see 11 lines from the botom). If you somehow have any duplicate variable's defined in the amportal.conf file REMOVE THE SECOND ONE, otherwise this will do nothing but cause you grief.
teknickal
Mon, 02/02/2009 - 08:26
Permalink
ALSO EDIT
Was getting this error after changing the pw, but its fixed now:
"FATAL ERROR
DB Error: connect failed"
Don't know if this is specific to Trixbox or any FreePBX, but I also had to edit this file before the web interface would work:
need to edit the password in:
/var/www/html/maint/modules/cdrreport/config/database.php
Just don't use any special characters like !@#$%^&*() in your password, unless you know how to set up literal strings, which I can't remember how to do at the moment.
fskrotzki
Mon, 02/02/2009 - 09:58
Permalink
That is a trixbox specific issue
That is a trixbox specific issue and yet another reason to not use them.
The Trixbox CD development team (which mostly was laid off in the last few weeks) has taken FreePBX code and forked it (some say to break it) jsut to be different.
To prove this point that module does not exist in FreePBX so it is clearly a Trixbox issue.
teknickal
Thu, 02/05/2009 - 09:18
Permalink
Thought so
I had a feeling it would be. To me though, Trixbox CE is worth it just for the endpoint manager (phone provisioning tool). It makes rolling out the Cisco and Linksys phones a breeze where they were a royal pain before.
robfantini
Tue, 02/23/2010 - 17:57
Permalink
trix
are for kids. [ like the old cereal commercial ]
seriously, I started using Trixbox and it was a great starting point. endpoint manager is the only thing I miss. but any system based on rpm's will never be as stable as debian.
now we are using Debian + asterisk from source + freepbx. protecting /etc and rock solid upgrades are the main benefit of Debian.
anyways I wanted to say that this how to worked great.
It will not work great for Trixbox as the next Trixbox upgrade may overwrite their file in /var/www/..
jibberjabber
Tue, 10/23/2012 - 09:57
Permalink
In addition to these files
In addition to these files the /etc/freepbx.conf needs to be updated.
http://www.freepbx.org/forum/freepbx/general-help/restore-a-backup-from-a-command-line
muqtada321
Wed, 12/19/2012 - 06:06
Permalink
This would help
This would help administering those devices. e.g. for Grandstream phones, there is a config file generation script. We should be able to get the mac address for the device associated with the extension and also get the username and password from the database. Outsourcing Services
anneyah
Wed, 01/16/2013 - 02:22
Permalink
There are many helpful
There are many helpful articiles posted on the internet and I found this one. Only few who wrote a tutorial post they may rather make it a video for more views. Although some wants to read article than watching those videos. I read some of the tutorial including this one, and I also look into a videos that has more views on youtube, because the more youtube views, means viewers relies on it, and learn from it at the same time.
ficmed
Fri, 02/22/2013 - 06:57
Permalink
SSH is the way
SSH is always the fastest way of doing things, however type carefully as using this method is more prone to mistakes than a GUI interface like myphpadmin Flipkart coupons .
joko
Tue, 04/16/2013 - 13:42
Permalink
The content here is truly
The content here is truly important.
http://www.zlotx.com