start : job failed to start (MySQL) - mysql

I went through various forum to increase the speed of the MySQL import and found that i have to increase the buffer size. So I added the following two lines in my.cnf file under [mysqld] section
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
innodb_buffer_pool_size=4G
innodb_log_file_size=1G
After adding these two lines if I restart the mysql server it displays
start: Job failed to start
If i am wrong where should i add these lines?

Related

Connecting to remote DB by default

Hello I'm trying to connect by default to a remote mysql DB I have on a cpanel
I already gave access to the IP I'm trying to use to connect to the remote DB in the cpanel
I tried changing /etc/mysql/mysql.conf.d/mysqld.conf
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
#skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 189.251.13.63
#
# * Fine Tuning
#
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover-options = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
After saving changes I went to /etc/init.d/ and then did mysqld restart
Tried using sudo mysql and it keeps going to my localhost DB, what am I doing wrong?
You can create $HOME/.my.cnf with following input:
[client]
user=...
host=...
port=...
mysql client should takes default connection parameters from this configuration file when you give no other option on the command line.

MySQL only starts in safe-mode

It appears that MySQL instance only starts when I issue the skip-grant-tables and when I go to start it the normal way, service mysql start I am getting the cannot connect to socket.
I have seen plenty of solutions but nothing has worked.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock nice = 0
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
bind-address = 127.0.0.1
key_buffer = 16M
max_allowed_packet = 16M
/var/run/mysqld# ls -atlr
total 0
drwxr-xr-x 22 root root 720 Oct 14 01:05 ..
drwxr-xr-x 2 mysql mysql 40 Oct 14 02:33 .
Steps to overcome
Go to Edit->Preferences menu under MySQL Workbench.
uncheck "Safe Update".
Restart WorkBench.
attached is the screenshot Screenshot from MySQL Workbench.

Mysql: CanĀ“t start Server debian wheezy

Everytime i try to start my mysql service i get the same error
Error message:
150130 15:56:31 [ERROR] Can't start server: Bind on TCP/IP port: Cannot assign requested address
150130 15:56:31 [ERROR] Do you already have another mysqld server running on port: 3305 ?
150130 15:56:31 [ERROR] Aborting
My Error log is empty
Conf file snippet:
[client]
port = 3305
socket = /var/run/mysqld/mysqld.sock
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3305
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
Sorry for my bad english
Complete Conf file
Looks like your port(3305) is occupied by another process.. you can :
1) switch to different port
2) kill/modify the process holding this port
(look it up using:
lsof -i :3305
)
in addition, this could be the cause of it (as one stated in this post) :
Change bind-address to 127.0.0.1 instead of localhost
Skipping network worked for me :
# echo "skip-networking" >> /etc/mysql/my.cnf
Then start mysql again.

multiple instances mysql on ubuntu error

I have been trying to make multiple instances of mysql on ubuntu. These are the steps I followed.
mv /etc/init.d/mysql /etc/init.d/mysql_mono.server
cp /usr/share/mysql/mysqld_multi.server /etc/init.d/mysql
With your favourite text editor, edit /etc/init.d/mysql, then find the lines:
basedir=/usr/local/mysql
bindir=/usr/local/mysql/bin
And change to:
basedir=/usr
bindir=/usr/bin
If your have a root password in localhost, edit the file /usr/bin/mysqld_multi, then find the line:
$opt_password = undef()
And change to:
$opt_password = "password"
changing "password" by the 'root'#'localhost' password.
Now create a database directory for each additional mysqld instance:
# cp -pr /var/lib/mysql /var/lib/mysql1
# cp -pr /var/lib/mysql /var/lib/mysql2
My configuration file(my.cnf) is:
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld1]
user = root
pid-file = /var/run/mysqld1.pid
socket = /var/run/mysqld1.sock
port = 3301
datadir = /var/lib/mysql1
log = /var/log/mysql/mysql1.log
server-id = 1
log_bin = /var/log/mysql/mysql1-bin.log
[mysqld2]
user = root
pid-file = /var/run/mysqld2.pid
socket = /var/run/mysqld2.sock
port = 3302
datadir = /var/lib/mysql2
log = /var/log/mysql/mysql2.log
server-id = 2
log_bin = /var/log/mysql/mysql2-bin.log
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
log_error = /var/log/mysql/error.log
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
key_buffer = 16M
``!includedir /etc/mysql/conf.d/
Still I get this error when i run following command:
mysql --socket=/var/run/mysqld1.sock -uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld1.sock' (2)
via http://dev.mysql.com/doc/refman/5.5/en/multiple-unix-servers.html
One way is to run multiple MySQL instances on Unix is to compile
different servers with different default TCP/IP ports and Unix socket
files so that each one listens on different network interfaces.
Compiling in different base directories for each installation also
results automatically in a separate, compiled-in data directory, log
file, and PID file location for each server.
Assume that an existing 5.1 server is configured for the default
TCP/IP port number (3306) and Unix socket file (/tmp/mysql.sock). To
configure a new 5.5.35 server to have different operating parameters,
use a CMake command something like this:
shell> cmake . -DMYSQL_TCP_PORT=port_number \
-DMYSQL_UNIX_ADDR=file_name \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5.35

MySQL my.cnf file - Found option without preceding group

I'm trying to connect to my DB in Ubuntu remotely but I receive error message when trying to mysql -u root -p:
Found option without preceding group in config file: /etc/mysql/my.cnf at line: 1
my.cnf looks like:
[mysqld]
user = mysql
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
bind-address = 0.0.0.0
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
myisam-recover = BACKUP
query_cache_limit = 1M
query_cache_size = 16M
log_error = /var/log/mysql/error.log
expire_logs_days = 10
max_binlog_size = 100M
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
[isamchk]
key_buffer = 16M
Missing config header
Just add [mysqld] as first line in the /etc/mysql/my.cnf file.
Example
[mysqld]
default-time-zone = "+08:00"
Afterwards, remember to restart your MySQL Service.
sudo mysqld stop
sudo mysqld start
Charset encoding
Check the charset encoding of the file. Make sure that it is in ASCII.
Use the od command to see if there is a UTF-8 BOM at the beginning, for example.
What worked for me:
Open my.ini with Notepad++
Encoding --> convert to ANSI
save
it is because of letters or digit infront of [mysqld] just check the leeters or digit anything is not required before [mysqld]
it may be something like
0[mysqld] then this error will occur
I had this problem when I installed MySQL 8.0.15 with the community installer. The my.ini file that came with the installer did not work correctly after it had been edited. I did a full manual install by downloading that zip folder. I was able to create my own my.ini file containing only the parameters that I was concerned about and it worked.
download zip file from MySQL website
unpack the folder into C:\program files\MySQL\MySQL8.0
within the MySQL8.0 folder that you unpacked the zip folder into, create a text file and save it as my.ini
include the parameters in that my.ini file that you are concerned about. so something like this(just ensure that there is already a folder created for the datadir or else initialization won't work):
[mysqld]
basedire=C:\program files\MySQL\MySQL8.0
datadir=D:\MySQL\Data
....continue with whatever parameters you want to include
initialize the data directory by running these two commands in the command prompt:
cd C:\program files\MySQL\MySQL8.0\bin
mysqld --default-file=C:\program files\MySQL\MySQL8.0\my.ini --initialize
install the MySQL server as a service by running these two commands:
cd C:\program files\MySQL\MySQL8.0\bin
mysqld --install --default-file=C:\program files\MySQL\MySQL8.0\my.ini
finally, start the server for the first time by running these two commands:
cd C:\program files\MySQL\MySQL8.0\bin
mysqld --console