For troubleshooting questions, please post in the following format:
Failed to ping DB , dial tcp 127.0.0.1:3306: connect: connection refused
Steps to reproduce
How can we reproduce the issue (what version are you using?)
while installing 7.10.3 mattermost version
I used such commands -
wget https://releases.mattermost.com/7.10.3/mattermost-7.10.3-linux-amd64.tar.gz
tar -xvzf mattermost*.gz
sudo mv mattermost /opt
sudo mkdir /opt/mattermost/data
sudo useradd --system --user-group mattermost
sudo chown -R mattermost:mattermost /opt/mattermost
sudo chmod -R g+w /opt/mattermost
sudo chmod -R g+w /opt/mattermost
after this I installed My SQL server using these commands
sudo apt update
sudo apt install mysql-server
sudo systemctl start mysql.service
also configured the MySQL with my desired password
sudo mysql
>> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'pass';
exit
finally, I started creating, configuring mattermost db
sudo nano /opt/mattermost/config/config.json
and changed this
"DriverName": "mysql",
"DataSource": "root:pass@tcp(localhost:3306)/mattermost?charset=utf8mb4,utf8&writeTimeout=30s"
For creating
mysql -u root -p
>> create database mattermost;
after this I tried to test if mattermost was working or not by using this command
cd /opt/mattermost
sudo -u mattermost bin/mattermost
**Expected behavior**
while testing the mattermost should work on the given port number without any error
**Observed behavior**
while launching the server I got stuck with an error
ubuntu@ayush:/opt/mattermost$ cd /opt/mattermost
sudo -u mattermost bin/mattermost
{"timestamp":"2023-06-26 18:35:56.897 Z","level":"info","msg":"Server is initializing...","caller":"platform/service.go:165","go_version":"go1.19.5"}
{"timestamp":"2023-06-26 18:35:56.898 Z","level":"info","msg":"Pinging SQL","caller":"sqlstore/store.go:242","database":"master","dataSource":"**:**@tcp(localhost:3306)/mattermost?writeTimeout=30s&charset=utf8mb4%2Cutf8"}
{"timestamp":"2023-06-26 18:35:56.900 Z","level":"error","msg":"Failed to ping DB","caller":"sqlstore/store.go:252","error":"dial tcp 127.0.0.1:3306: connect: connection refused","retrying in seconds":10}