# I cant login to mysql



## Kamilosm (Mar 25, 2017)

Hi guys, im working on vps with freebsd 10.3p11 on it. I instaled mysql55-server, i created users gave them prermissons etc. After then i rebooted my maschine and now i cant login. When i used 

```
service mysql-server start
```
it said that mysql-server started but i cant see the process (used 
	
	



```
ps -x
```
)
when i tried to login(
	
	



```
mysql -p
```
) i saw 

```
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (61)
```
There is some simillar threads on the internet but it doesnt work for me. Im sorry for my laguage which is hard to stand. I really need some help. Any suggestions ?


----------



## balanga (Mar 25, 2017)

Try `service mysql-server status`.

It may be that the process stopped immediately because of an exiting socket.


----------



## sk8harddiefast (Mar 26, 2017)

Searching on internet is probably an "Error" kind MySQL is installed but not running. Before a few months I was playing with MySQL. I remember that the first time I should check out the MySQL configuration file and I should login and create a root / user password. Try this


```
mysql_secure_installation
```
 (You can set a password for root accounts)

Or


```
mysql -u root -p
```

When you login


```
> mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
mysql> SET PASSWORD FOR 'root'@'server_host_name' = PASSWORD('newpwd');
```

To enable root user from other hosts.


```
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'pwd' WITH GRANT OPTION;
```

To make mysql listen for connections from other hosts (not just local) comment out "bind-address = 127.0.0.1" in my.cnf (MySQL configuration file)

(I found that from Ubuntu's forum but this is what I made as far as I remember)


----------



## Kamilosm (Mar 26, 2017)

Ive tried to reinstall mysql and now it broke down seriously. I had deinstalled mysql succesfully and now i cant install it anymore. I have some problems with pkg and i cant handle with that 
	
	



```
[root@FreeBSD(/)]>  pkg install mysql56-server
Updating repository catalogue
digests.txz                         100% 2227KB   2.2MB/s   1.0MB/s   00:01
packagesite.txz                     100% 5813KB   1.9MB/s   3.5MB/s   00:03
pkg: package field incomplete: comment
Incremental update completed, 26218 packages processed:
0 packages updated, 0 removed and 26218 added.
pkg: Unable to find catalogs
[root@FreeBSD(/)]>  pkg update -f
Updating repository catalogue
digests.txz                         100% 2227KB   2.2MB/s 687.0KB/s   00:01
packagesite.txz                     100% 5813KB   2.8MB/s   3.2MB/s   00:02
pkg: package field incomplete: comment
Incremental update completed, 26218 packages processed:
0 packages updated, 0 removed and 26218 added.
pkg: Unable to find catalogs
[root@FreeBSD(/)]>  cd /usr/local/etc/pkg/repos/
-bash: cd: /usr/local/etc/pkg/repos/: No such file or directory
[root@FreeBSD(/)]>  cd /usr/local/etc/pkg
-bash: cd: /usr/local/etc/pkg: No such file or directory
[root@FreeBSD(/)]>  cd /usr/local/etc
[root@FreeBSD(/usr/local/etc)]>  ls
bash_completion.d  man.d  periodic       pkg.conf.sample  wgetrc.sample
devd               pam.d  perl5_version  rc.d
[root@FreeBSD(/usr/local/etc)]>  portsnap fetch update
Looking up portsnap.FreeBSD.org mirrors... 6 mirrors found.
Fetching snapshot tag from ec2-eu-west-1.portsnap.freebsd.org... done.
Fetching snapshot metadata... done.
Updating from Sun Mar 26 11:28:40 CET 2017 to Sun Mar 26 14:19:00 CET 2017.
Fetching 5 metadata patches... done.
Applying metadata patches... done.
Fetching 0 metadata files... done.
Fetching 13 patches.
(13/13) 100.00%  done.
done.
Applying patches...
done.
Fetching 0 new ports or files... done.
Removing old files and directories... done.
Extracting new files:
/usr/ports/Mk/Uses/
/usr/ports/deskutils/kdepim4-runtime/
/usr/ports/deskutils/kdepim4/
/usr/ports/deskutils/kdepimlibs4/
/usr/ports/devel/pear/
/usr/ports/graphics/alembic/
/usr/ports/irc/weechat/
/usr/ports/mail/libvmime/
/usr/ports/net-im/ricochet/
/usr/ports/science/orthanc/
/usr/ports/security/acme-client/
/usr/ports/security/certificate-transparency/
/usr/ports/sysutils/baloo/
Building new INDEX files... done.
[root@FreeBSD(/usr/local/etc)]>  cd /usr/local/etc/pkg
-bash: cd: /usr/local/etc/pkg: No such file or directory
[root@FreeBSD(/usr/local/etc)]>  pkg fetch -y pkg
Updating repository catalogue
digests.txz                         100% 2227KB   2.2MB/s   1.8MB/s   00:01
packagesite.txz                     100% 5813KB   2.8MB/s   2.1MB/s   00:02
pkg: package field incomplete: comment
Incremental update completed, 26218 packages processed:
0 packages updated, 0 removed and 26218 added.
pkg: Unable to find catalogs
[root@FreeBSD(/usr/local/etc)]>  pkg audit -F
vuln.xml.bz2                        100%  685KB 684.5KB/s 684.5KB/s   00:00
libidn-1.28_1 is vulnerable:
libidn -- out-of-bounds read issue with invalid UTF-8 input
CVE: CVE-2015-2059
WWW: http://portaudit.FreeBSD.org/4caf01e2-30e6-11e5-a4a5-002590263bf5.html

libidn-1.28_1 is vulnerable:
libidn -- mulitiple vulnerabilities
CVE: CVE-2016-6263
CVE: CVE-2016-6262
CVE: CVE-2015-8948
CVE: CVE-2016-6261
WWW: http://portaudit.FreeBSD.org/cb5189eb-572f-11e6-b334-002590263bf5.html

perl5-5.16.3_4 is vulnerable:
perl5 -- taint mechanism bypass vulnerability
CVE: CVE-2016-2381
WWW: http://portaudit.FreeBSD.org/d9f99491-1656-11e6-94fa-002590263bf5.html

perl5-5.16.3_4 is vulnerable:
End of Life Ports
WWW: http://portaudit.FreeBSD.org/7fe7df75-6568-11e6-a590-14dae9d210b8.html

pkg-1.2.4_1 is vulnerable:
libyaml heap overflow resulting in possible code execution
CVE: CVE-2013-6393
WWW: http://portaudit.FreeBSD.org/111f1f84-1d14-4ff2-a9ea-cf07119c0d3b.html

wget-1.14_2 is vulnerable:
wget -- path traversal vulnerability in recursive FTP mode
CVE: CVE-2014-4877
WWW: http://portaudit.FreeBSD.org/ee7b4f9d-66c8-11e4-9ae1-e8e0b722a85e.html

wget-1.14_2 is vulnerable:
wget -- HTTP to FTP redirection file name confusion vulnerability
CVE: CVE-2016-4971
WWW: http://portaudit.FreeBSD.org/6df56c60-3738-11e6-a671-60a44ce6887b.html

wget-1.14_2 is vulnerable:
wget -- Access List Bypass / Race Condition
CVE: CVE-2016-7098
WWW: http://portaudit.FreeBSD.org/479c5b91-b6cc-11e6-a04e-3417eb99b9a0.html

4 problem(s) in the installed packages found.
[root@FreeBSD(/usr/local/etc)]>  pkg install cfdisk gdisk
Updating repository catalogue
digests.txz                         100% 2227KB   2.2MB/s   2.2MB/s   00:01
packagesite.txz                     100% 5813KB   1.9MB/s   2.3MB/s   00:03
pkg: package field incomplete: comment
Incremental update completed, 26218 packages processed:
0 packages updated, 0 removed and 26218 added.
pkg: Unable to find catalogs
```
No matter what i do it allways talking about catalogs. I tried  to update ports by portsnap and reinstall pkg but it doesnt work:

```
[root@FreeBSD(/)]>  cd /usr/ports/ports-mgmt/pkg
[root@FreeBSD(/usr/ports/ports-mgmt/pkg)]>  make deinstall clean
===>  Deinstalling for pkg
/usr/ports/ports-mgmt/pkg/work/pkg-1.10.0/src/pkg-static: not found
===>   pkg not installed, skipping
===>  Cleaning for pkg-1.10.0_2
[root@FreeBSD(/usr/ports/ports-mgmt/pkg)]>
[root@FreeBSD(/usr/ports/ports-mgmt/pkg)]>  make deinstall clean
===>  Deinstalling for pkg
/usr/ports/ports-mgmt/pkg/work/pkg-1.10.0/src/pkg-static: not found
===>   pkg not installed, skipping
===>  Cleaning for pkg-1.10.0_2
[root@FreeBSD(/usr/ports/ports-mgmt/pkg)]>  make install clean
/!\ ERROR: /!\

Ports Collection support for your FreeBSD version has ended, and no ports are
guaranteed to build on this system. Please upgrade to a supported release.

No support will be provided if you silence this message by defining
ALLOW_UNSUPPORTED_SYSTEM.

*** Error code 1

Stop.
make: stopped in /usr/ports/ports-mgmt/pkg
[root@FreeBSD(/usr/ports/ports-mgmt/pkg)]>  uname -mrs
FreeBSD 10.3-RELEASE-p11 i386
[root@FreeBSD(/usr/ports/ports-mgmt/pkg)]>
```
Any suggestions?


----------



## sk8harddiefast (Mar 26, 2017)

```
Ports Collection support for your FreeBSD version has ended, and no ports are
guaranteed to build on this system. Please upgrade to a supported release.

No support will be provided if you silence this message by defining
ALLOW_UNSUPPORTED_SYSTEM.
```

First of all may you wanted to update to FreeBSD-11 which is is the latest stable release


```
freebsd-update upgrade -r 11.0-RELEASE
```

After that you should update your ports tree using


```
portsnap fetch update
```

Do a cleaning on your ports tree to be sure that removed any work directory that may cause error during compile


```
portsclean -CDD
```
(You may need to install ports-mgmt/portupgrade from ports first to do that)

Finally try to install `pkg` again from ports.

Also may stupid but can you post the output of


```
pkg info | grep pkg
```

On a proper working machine with pkg fully working should return something like this


```
[ember@FreeBSD] /usr/home/ember$ pkg info | grep pkg                                     
pkg-1.10.0_2                   Package manager
pkgconf-1.3.2                  Utility to help to configure compiler and linker flags
```

Using `pkg info | grep "a package"` you see if the package is actually installed on system. If return something like `pkg not found` means that `pkg` itself is deinstalled.


----------

