I have installed some production, there is mysql embedded instance in production. Installation is successful, but when I tried to connect mysql instannce, I got following error messages.
[root#MiWiFi-R3D-srv bin]# ./mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/msql.sock' (2)
[root#MiWiFi-R3D-srv bin]#
[root#MiWiFi-R3D-srv bin]#
I can sure mysql instance is running.
aam 13390 1 0 08:01 ? 00:00:00 /bin/sh /opt/SIU_MANAGER/mysq /bin/mysqld_safe --defaults-file=/var/opt/SIU_MANAGER/mysql/my.cnf --pid-file=/var/opt/AAM/mysql/data/my.pid --ledir=/opt/AAM/mysql/bin --basedir=/opt/AAM/mysql --tmpdir=/var/opt/AAM/mysql/tmp/ --datadir=/var/opt/AAM/mysql/data --character-sets-dir=/opt/AAM/mysql/share/charsets/ --lc-messages-dir=/opt/AAM/mysql/share --lc-messages=en_US --user=bin
aam 13578 13390 0 08:01 ? 00:00:02 /opt/AAM/mysql/bin/mysqld --defaults-file=/var/opt/AAM/mysql/my.cnf --basedir=/opt/AAM/mysql --datadir=/var/opt/AAM/mysql/data --plugin-dir=/opt/AAM/mysql/lib/plugin --tmpdir=/var/opt/AAM/mysql/tmp/ --character-sets-dir=/opt/AAM/mysql/share/charsets/ --lc-messages-dir=/opt/AAM/mysql/share --lc-messages=en_US --log-error=MiWiFi-R3D-srv.err --pid-file=/var/opt/AAM/mysql/data/my.pid
root 17786 11762 0 08:27 pts/1 00:00:00 grep --color=auto mysql
I did little research. Mysql offical solution is that execute sql in mysql, but if I can not connect sql
I can not execute any sql.
Mysql offical solution https://dev.mysql.com/doc/mysql-security-excerpt/5.7/en/account-locking.html
When used with ALTER USER, these clauses specify the new locking state
for an existing account. In the absence of either clause, the account
locking state remains unchanged.
This is mysql version.
[root#MiWiFi-R3D-srv bin]# ./mysqladmin -V
./mysqladmin Ver 8.42 Distrib 5.7.25, for linux-glibc2.12 on x86_64
[root#MiWiFi-R3D-srv bin]#
How do I unlcok root user?
PS: I have root privillage of OS.
Thank you for answer me.
It looks like, for some reason, your communication socket for MySQL is being created in /tmp, and is presumably being deleted by some process that periodically cleans up /tmp.
You can get it back by restarting the mysqld process through whatever means is appropriate to your system.
You should also move it out of /tmp, perhaps into /var/run.
Related
I need to check if mysql is installed on a ubuntu server. Is there a way to determine if mySql has been installed ? Thanks.
You can use tool dpkg for managing packages in Debian operating system.
Example
dpkg --get-selections | grep mysql if it's listed as installed, you got it. Else you need to get it.
"mysql" may be found even if mysql and mariadb is uninstalled, but not "mysqld".
Faster than rpm -qa | grep mysqld is:
which mysqld
Multiple ways of searching for the program.
Type mysql in your terminal, see the result.
Search the /usr/bin, /bin directories for the binary.
Type apt-cache show mysql to see if it is installed
locate mysql
With this command:
dpkg -s mysql-server | grep Status
# mysqladmin -u root -p status
Output:
Enter password:
Uptime: 4 Threads: 1 Questions: 62 Slow queries: 0 Opens: 51 Flush tables: 1 Open tables: 45 Queries per second avg: 15.500
It means MySQL serer is running
If server is not running then it will dump error as follows
# mysqladmin -u root -p status
Output :
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
So Under Debian Linux you can type following command
# /etc/init.d/mysql status
In an RPM-based Linux, you can check presence of MySQL like this:
rpm -qa | grep mysql
For debian or other dpkg-based systems, check like this:
*
dpkg -l mysql-server libmysqlclientdev*
*
Lots of answers. It should have been a simple command. Just type mysql --version on your terminal and hit enter.
Try executing 'mysql' or 'mysql -- version' without quotes on terminal.
it will prompt version otherwise Command Not Found
I recently updated my version of cPanel to v78.0.17 and upgraded MySQL from 5.6 to 5.7.
I had some errors during the startup of the MySQL server which I resolved by running the cPanel MySQL/MariaDB Upgrade a second time.
From what I can see the MySQL is running and operating as expected. However I am now receiving cPanel Notifications from Service Manager (tailwatchd) that the MySQL service is down.
root#hostname [~]# ps faux |grep -i mysql
root 16516 0.0 0.0 112708 996 pts/0 S+ 11:05 0:00 | \_ grep --color=auto -i mysql
mysql 15308 1.5 0.2 1310132 82508 ? Sl 11:02 0:02 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
extract from /var/log/chkservd.log
mysql [[check command:-][check command output:(XID 4jtb2a) The “mysql” service is down: mysqladmin: [ERROR] unknown variable 'pass=xxxxxxxx'
The subprocess “/usr/local/cpanel/scripts/restartsrv_mysql” reported error number 255 when it ended.][socket connect:N/A][fail count:66]Restarting mysql....
[notify:failed service:mysql]]...
I have found this link on the cPanel Forum https://forums.cpanel.net/threads/tailwatch-service-manager-has-stopped-monitoring-mysql.648093/#post-2643253 however I do not see the fix.
Can anyone shed light on a possible fix for this?
It was an issue with the /root/.my.cnf file.
MySQL 5.6 allows the property 'pass' while MySQL 5.7 requires the property 'password'
The upgrade process in cPanel (MySQL/MariaDB Upgrade) does not update/correct this file.
MySQL 5.6 (pre MySQL 5.7)
[client]
user=root
pass='xxxxx'
MySQL 5.7
[client]
user=root
password='xxxxx'
Thanks to cPanel Support for solving this issue.
I recently had my MySQL server upgraded from 5.1 to 5.5 and I'm trying to upgrade my databases using mysql_upgrade but I keep getting this error:
[root#ip-??-???-???-??? ~]# mysql_upgrade -uadmin -p
Enter password:
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
FATAL ERROR: Upgrade failed
I can't figure why this won't run. MySQL Server is running.
I had the same issue going from MySQL 5.5 to 5.6 on OS X (installed via MacPorts).
Seems that mysql_upgrade needs to be run as user root and only root and a password needs to be set up for the user. Any other user with administrative privileges does not seem work.
So the only valid command seems to be: mysql_upgrade -u root -p
Initial solution by Chris_H at FreeBSD forums.
Worked for me, but I had to use this:
mysql_upgrade --port=3306 --user=root --password=PASSWORD
I work on
mysql -V
mysql Ver 14.14 Distrib 5.5.35, for debian-linux-gnu (x86_64) using readline 6.3
For my case, I need to pass my socket file location explicitly.
mysql_upgrade -S /usr/local/mysql/mysql.sock
If you run MySQL on a non-standard port be sure to include --port=xxxxxx
I found that skipping that can cause the error you're getting.
The FATAL ERROR is solved:
1º - Execute shell command: service mysqld stop
2º - Then, rename /etc/my.cnf to /etc/my.cnfbkp
3º - Execute shell command: service mysqld start
4º - Execute shell command: mysql_upgrade -u root -p YOUR_ROOT_PASSWORD
5º - Rename /etc/my.cnfbkp to /etc/my.cnf
6º - Execute shell command: service mysqld restart
My installation on Windows server requires port and user/pass specification.
--port=3306 --user=root --password=XXXX
Just add the configuration line to your my.cnf
At the end add
[mysqlcheck]
socket = /dbabcstorage/data/mysql5/mysql.sock
the correct value you can copy in the previous lines of my.cnf
This worked for me on a CentOS/Plesk server:
mysql_upgrade -uadmin -p< /etc/psa/.psa.shadow -f
service mysqld restart
http://kb.sp.parallels.com/en/427
SOLVED!
Follow the steps as ADMINISTRATOR account:
1) Install MySQL
2) In the my.ini file, located on the MySQL path, set datadir e basedir
3) Move ALL THE CONTENT of "%MySQL%/Data" folder to the datadir above
4) Run the upgrade:
mysql_upgrade
5) Create Windows Service like this:
sc create MySQL binPath=C:/MySQL
To remove the Windows Service:
sc delete MySQL
I’m trying to import a 4GB+ SQL to MySQL 5.6 (64-bit) on Windows 7 (64-bit)
The problem is I after a few seconds (), get this message:
ERROR 2006 (HY000) at line 204: MySQL server has gone away
It does import, but it only the first 3 tables (the first 2 and the 3rd table just the structure.
I’ve been trying this command:
mysql -u root -p firedb < C:\database_2013-11-12.sql
I tried a lot of things I could find here on stackoverflow with no success yet:
[mysqld]
innodb_file_per_table
max_allowed_packet=2048M
wait_timeout=3600
net_read_timeout=3600
net_buffer_length=3600
The SQL file was created on “MySQL 5.1.72-2-log (Debian)” using this command:
mysqldump -u root -p --all-databases
I have also tried setting --max_allowed_packet when running the command like this:
mysql --max_allowed_packet=2048M -u root -p --all-databases
The Documentation states:
The most common reason for the MySQL server has gone away error is
that the server timed out and closed the connection.
By default, the server closes the connection after eight hours if
nothing has happened. You can change the time limit by setting the
wait_timeout variable when you start mysqld. See Section 5.1.4,
“Server System Variables”.
If you have a script, you just have to issue the query again for the
client to do an automatic reconnection. This assumes that you have
automatic reconnection in the client enabled (which is the default for
the mysql command-line client).
So i would start with increasing the timeout.
And if this does not help read int he attached documentation link for the rest of reasons for server has gone away error.
Im trying to login to MySQL in localhost using the root username (default) with no password entering the following command:
mysql -u root -h localhost
I dont get the 'mysql>' and it does not fail so im left with the terminal letting me type but it does not execute any commands (inside or outside of mysql). I also tried using -p and leaving the password blank and I get the same result
Check the following (taken from http://dev.mysql.com/doc/mysql-linuxunix-excerpt/5.5/en/unix-postinstallation.html )
Use mysqladmin to verify that the server is running. The following commands provide simple tests to check whether the server is up and responding to connections:
shell> bin/mysqladmin version
shell> bin/mysqladmin variables
The output from mysqladmin version varies slightly depending on your platform and version of MySQL, but should be similar to that shown here:
shell> bin/mysqladmin version
mysqladmin Ver 14.12 Distrib 5.5.29, for pc-linux-gnu on i686
...
Server version 5.5.29
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 14 days 5 hours 5 min 21 sec
Threads: 1 Questions: 366 Slow queries: 0
Opens: 0 Flush tables: 1 Open tables: 19
Queries per second avg: 0.000
If you are unable to run that command then your installation is either not complete (follow the instructions starting at the top of the page ) or you do not have permission as the user to execute the mysql program.