user2315104
user2315104

Reputation: 2722

what is proper mysql database connection string

i am using following connection string :

mysql://root:root@newserver/metro

where

username: root

password: root

server : newserver

database: metro

getting following error :

2017/08/19 06:10:02 default addr for network 'newserver' unknown

here are mysql server logs :

Redirecting to /bin/systemctl status mysqld.service ● mysqld.service - MySQL Community Server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled) Active: active (running) since Fri 2017-08-18 17:14:59 UTC; 12h ago Process: 23510 ExecStartPost=/usr/bin/mysql-systemd-start post (code=exited, status=0/SUCCESS) Process: 23447 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=0/SUCCESS) Main PID: 23509 (mysqld_safe) CGroup: /system.slice/mysqld.service ├─23509 /bin/sh /usr/bin/mysqld_safe --basedir=/usr └─23676 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysqld.log --pid-file=/var/run/...

Aug 18 17:14:58 newserver mysql-systemd-start[23447]: Support MySQL by buying support/licenses at http://shop.mysql.com Aug 18 17:14:58 newserver mysql-systemd-start[23447]: Note: new default config file not created. Aug 18 17:14:58 newserver mysql-systemd-start[23447]: Please make sure your config file is current Aug 18 17:14:58 newserver mysql-systemd-start[23447]: WARNING: Default config file /etc/my.cnf exists on the system Aug 18 17:14:58 newserver mysql-systemd-start[23447]: This file will be read by default by the MySQL server Aug 18 17:14:58 newserver mysql-systemd-start[23447]: If you do not want to use this, either remove it, or use the Aug 18 17:14:58 newserver mysql-systemd-start[23447]: --defaults-file argument to mysqld_safe when starting the server Aug 18 17:14:58 newserver mysqld_safe[23509]: 170818 17:14:58 mysqld_safe Logging to '/var/log/mysqld.log'. Aug 18 17:14:58 newserver mysqld_safe[23509]: 170818 17:14:58 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql Aug 18 17:14:59 newserver systemd[1]: Started MySQL Community Server.

following are the contents of /etc/hosts

172.31.43.60 newserver

this configuration is there on single machine and i am trying to access using golang program.

here is the url for the same :

https://github.com/utronframework/tutorials/blob/master/create_todo_list_application_with_utron.md

the filename is config/app.json

here is my app.json file

{
    "app_name": "utron web app",
    "base_url": "http://localhost:8090",
    "port": 8090,
    "verbose": false,
    "static_dir": "static",
    "view_dir": "views",
    "database": "mysql",
    "database_conn": "mysql://root:root@newserver/metro",
    "automigrate": true

}

please suggest

Upvotes: 0

Views: 585

Answers (1)

robertklep
robertklep

Reputation: 203304

I have no clue about Go, but I can read the documentation, which suggests that you need to use this:

root:root@tcp(newserver)/metro

Or possibly:

mysql://root:root@tcp(newserver)/metro

Upvotes: 2

Related Questions