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
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
Related
I installed mysql in my server. But it failed to start.
The error shows here:
the systemctl status mysqld.service info:
[root#localhost run]# systemctl status mysqld.service
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Sat 2021-05-29 10:47:55 CST; 35s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 256566 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=217/USER)
May 29 10:47:55 localhost.localdomain systemd[1]: Failed to start MySQL Server.
May 29 10:47:55 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.
May 29 10:47:55 localhost.localdomain systemd[1]: mysqld.service failed.
May 29 10:47:55 localhost.localdomain systemd[1]: mysqld.service holdoff time over, sche...t.
May 29 10:47:55 localhost.localdomain systemd[1]: Stopped MySQL Server.
May 29 10:47:55 localhost.localdomain systemd[1]: start request repeated too quickly for...ce
May 29 10:47:55 localhost.localdomain systemd[1]: Failed to start MySQL Server.
May 29 10:47:55 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.
May 29 10:47:55 localhost.localdomain systemd[1]: mysqld.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
thejournalctl -xeinfo:
May 29 10:48:00 localhost.localdomain postfix/master[21438]: warning: process /usr/libexec/postfix/pickup pid 257074 exit status 127
May 29 10:48:00 localhost.localdomain postfix/master[21438]: warning: /usr/libexec/postfix/pickup: bad command startup -- throttling
May 29 10:49:00 localhost.localdomain postfix/master[21438]: warning: process /usr/libexec/postfix/pickup pid 263057 exit status 127
May 29 10:49:00 localhost.localdomain postfix/master[21438]: warning: /usr/libexec/postfix/pickup: bad command startup -- throttling
May 29 10:50:00 localhost.localdomain postfix/master[21438]: warning: process /usr/libexec/postfix/pickup pid 269083 exit status 127
May 29 10:50:00 localhost.localdomain postfix/master[21438]: warning: /usr/libexec/postfix/pickup: bad command startup -- throttling
May 29 10:50:01 localhost.localdomain systemd[1]: Started Session 2986 of user root.
-- Subject: Unit session-2986.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-2986.scope has finished starting up.
--
-- The start-up result is done.
I tried to run chown -R mysql:mysql /var/lib/mysql, It shows like this:
chown: invalid user: ‘mysql:mysql’
How can I start mysql?
You can fix this in few steps
Execute this command to check if mysql user exists: cat /etc/passwd | grep mysql
Validate if you have mysql in this file. It should look something like : mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/false
If mysql user is not present please create that user like this : useradd -d /var/lib/mysql mysql
If mysql user is present then make sure mysql user home path in /etc/passwd file actually exists and owned by mysql user (in the above case I mentioned /var/lib/mysql is home path and it has to be owned by mysql user)
Note: from what ever you have mentioned it looked like mysql user doesn't exist in your system. So it looks like creating the user with home path as /var/lib/mysql should solve the problem.
I'm using Ubuntu 16.04 and installed MySQL version 5.7 via apt-get in AWS.
After that, I've managed to upgrade the MySQL to Galera Cluster by following the Documentation from the official website using apt-get install galera-3 galera-arbitrator-3 mysql-wsrep-5.6
After that I've configured the file /etc/mysql/conf.d/galera.cnf to be:
[mysqld]
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
bind-address=0.0.0.0
# Galera Provider Configuration
wsrep_on=ON
wsrep_provider=/usr/lib/galera/libgalera_smm.so
# Galera Cluster Configuration
wsrep_cluster_name="test_cluster"
wsrep_cluster_address="gcomm://this_node_ip,second_ip,third_ip"
# Galera Synchronization Configuration
wsrep_sst_method=rsync
# Galera Node Configuration
wsrep_node_address="this_node_ip"
wsrep_node_name="this_node_name"
The step above is repeated for the other 2 nodes (with it's own IP address). And stop the mysql with the following command sudo service mysql stop for each of the node.
And in the first node, I'm trying to start with the following command:
sudo service mysql start --wsrep-new-cluster
But it returns: Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
In the systemctl status mysql.service, it says:
● mysql.service - LSB: start and stop MySQL
Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2018-02-09 15:53:16 +08; 33s ago
Docs: man:systemd-sysv-generator(8)
Process: 6264 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)
Feb 09 15:53:15 systemd[1]: Starting LSB: start and stop MySQL...
Feb 09 15:53:15 mysql[6264]: Starting MySQL
Feb 09 15:53:15 mysql[6264]: .180209 15:53:15 mysqld_safe Can't log to error log and syslog at the same time. Remove all --log-error configuration options for --syslog to take effect.
Feb 09 15:53:15 mysql[6264]: 180209 15:53:15 mysqld_safe Directory '/var/run/mysqld' for UNIX socket file don't exists.
Feb 09 15:53:16 mysql[6264]: * The server quit without updating PID file (/var/run/mysqld/mysqld.pid).
Feb 09 15:53:16 systemd[1]: mysql.service: Control process exited, code=exited status=1
Feb 09 15:53:16 systemd[1]: Failed to start LSB: start and stop MySQL.
Feb 09 15:53:16 systemd[1]: mysql.service: Unit entered failed state.
Feb 09 15:53:16 systemd[1]: mysql.service: Failed with result 'exit-code'.
Hope these information helps.
For a particular project I wanted to have Mint (Sonja) appliance with all MariaDB and only MariaDB doing MySQL's work, without a hint of MySQL so I know I'm working with MariaDB.
The appliance is one where I've installed multiple open source projects that power their own website (Alfresco, Request Tracker, SuiteCRM, etc.), and all of them seem to have worked either with MariaDB, or just used Postgres without interesting difficulty, and up until I tried to create a new MariaDB database to add a clone of a specific Wordpress site, MariaDB worked predictably well with no headaches on the same system. Until now, where I can't seem to find a pulse.
The MariaDB troubleshooting page confirmed what I'd found in my investigations (in particular, a ps wwaux | grep mysql only turned up the grep process). The basic problem as I'd encountered it was when I tried to log in to create a database:
monk#toolchest ~ $ mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2 "No such file or directory")
I've never gotten involved with MySQL's or MariaDB's /etc configuration files, but I looked briefly. They appeared sane to my uneducated eye.
Neither an aptitude reinstall mariadb-server nor a service mysql start produce any changes so far as I could tell.
For service mysql start, I got:
# service mysql start
Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details.
The details for systemctl status mysql.service were:
● mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql; bad; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2017-07-14 18:16:38 EEST; 1min 11s ago
Docs: man:systemd-sysv-generator(8)
Process: 5011 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)
Jul 14 18:16:38 toolchest /etc/init.d/mysql[5479]: 0 processes alive and '/usr/bin/mysql
Jul 14 18:16:38 toolchest /etc/init.d/mysql[5479]: [61B blob data]
Jul 14 18:16:38 toolchest /etc/init.d/mysql[5479]: error: 'Can't connect to local MySQL
Jul 14 18:16:38 toolchest /etc/init.d/mysql[5479]: Check that mysqld is running and that
Jul 14 18:16:38 toolchest /etc/init.d/mysql[5479]:
Jul 14 18:16:38 toolchest mysql[5011]: ...fail!
Jul 14 18:16:38 toolchest systemd[1]: mysql.service: Control process exited, code=exited
Jul 14 18:16:38 toolchest systemd[1]: Failed to start LSB: Start and stop the mysql data
Jul 14 18:16:38 toolchest systemd[1]: mysql.service: Unit entered failed state.
Jul 14 18:16:38 toolchest systemd[1]: mysql.service: Failed with result 'exit-code'.
The recent (i.e. non-cronned) content of journalctl -xe ran:
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Jul 14 18:16:38 toolchest systemd[1]: mysql.service: Unit entered failed state.
Jul 14 18:16:38 toolchest systemd[1]: mysql.service: Failed with result 'exit-code'.
/etc/mysql/mariadb.cnf and /etc/mysql/my.cnf both read (comments stripped):
[client-server]
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/
/etc/mysql/my.cnf.fallback dropps the latter !includedir. Commenting out the latter /etc/mysql/my.cnf to match the fallback file produced identical results.
I can edit my question to include more of /etc/mysql/*, but I wanted to ask. Error messages similar to the ERROR 2002 are to be found in questions like Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (38), but these appear to be MySQL rather than MariaDB, and I suspect this may be a MariaDB-specific fluke.
So I've been working on a rails server with MySQL and suddenly can't access my database. When I try to log in with mysql -u root -p I get ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2). I've read most of the forums I can find and looked through all the logs trying to reset mysqld.sock. I've tried reinstalling and repackaging unsuccessfully. The weird thing is that var/run/mysqld/ doesn't even exist after reinstalling.
So I decided to just back up my databases and overhaul everything. I cleaned out both apache and mysql with apt-get remove --purge and reinstalled. All went fine, apache launched fine, and then tried to relaunch mysql with systemctl start mysql which gave a prompt to check the log which says:
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: inactive (dead) (Result: exit-code) since Fri 2016-12-16 23:56:19 UTC; 17s ago
Process: 15690 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: mysql.service: Control process exited, code=exited status=1
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: Failed to start MySQL Community Server.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: mysql.service: Unit entered failed state.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: mysql.service: Failed with result 'exit-code'.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: Stopped MySQL Community Server.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: mysql.service: Start request repeated too quickly.
Dec 16 23:56:19 ip-172-31-0-55 systemd[1]: Failed to start MySQL Community Server.
Update - I created the folder mysqld, which seems to allow sudo mysqld --initialize to run. Unfortunately this yielded the error
2016-12-17T00:16:36.298825Z 0 [ERROR] Can't change data directory owner to mysql
2016-12-17T00:16:36.299212Z 0 [ERROR] Aborting
So no party yet. Any thoughts would be hugely appreciated.
edit /etc/mysql/conf.d/mysql.cnf :
sudo nano /etc/mysql/conf.d/mysql.cnf
add this line :
socket=/var/run/mysqld/mysqld.sock
then restart mysql service :
sudo service mysql restart
I lost my mysql password and need to reset it.
I have already tried https://help.ubuntu.com/community/MysqlPasswordReset
With the following result
erik#Trantor:~$ sudo /etc/init.d/mysql stop
[ ok ] Stopping mysql (via systemctl): mysql.service.
erik#Trantor:~$ sudo /usr/sbin/mysqld --skip-grant-tables &
[1] 21335
erik#Trantor:~$
[1]+ Exit 1 sudo /usr/sbin/mysqld --skip-grant-tables
erik#Trantor:~$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
erik#Trantor:~$
I did not use the skip-networking option as that has been indicated by another post to cause it's own trouble and I'm not worried about security at the moment. Through some checking, I found that the service is failing to actually start with that option.
erik#Trantor:~$ sudo service mysql status
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en
Active: inactive (dead) since Sun 2016-11-06 10:41:56 EST; 3min 45s ago
Process: 20846 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=e
Process: 20845 ExecStart=/usr/sbin/mysqld (code=exited, status=0/SUCCESS)
Process: 20842 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exi
Main PID: 20845 (code=exited, status=0/SUCCESS)
Nov 06 10:35:01 Trantor systemd[1]: Starting MySQL Community Server...
Nov 06 10:35:02 Trantor systemd[1]: Started MySQL Community Server.
Nov 06 10:41:55 Trantor systemd[1]: Stopping MySQL Community Server...
Nov 06 10:41:56 Trantor systemd[1]: Stopped MySQL Community Server.
lines 1-12/12 (END)
I'm not sure how to get mysql to start with the -skip-grant-tables option at this point, and without my password, I'm dead in the water.
I have tried to remove and install mysql-server again.
Anyone know how I can get it to start with the flag, or where I should look next?