How to disable --skip-grant-tables in MySQL? - mysql

I am trying to initialize the database for my OpenGTS installation. However, when I run the shell script that accomplishes this, I get the following error:
Version: 2.4.5
Database created: gts
[ERROR|DBAdmin.execCommands:843] ==> SQLException: DB grant error [jdbc:mysql://localhost:3306/]
[ERROR|DBAdmin.execCommands:843] Message: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
[ERROR|DBAdmin.execCommands:843] SQLState: HY000
[ERROR|DBAdmin.execCommands:843] ErrorCode: 1290
[DBAdmin.execCommands:843] java.sql.SQLException: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
java.sql.SQLException: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2642)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1647)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1566)
at org.opengts.dbtools.DBConnection._executeUpdate(DBConnection.java:961)
at org.opengts.dbtools.DBConnection.executeUpdate(DBConnection.java:908)
at org.opengts.dbtools.DBConnection.executeUpdate(DBConnection.java:889)
at org.opengts.dbtools.DBProvider.grantDBUser(DBProvider.java:2132)
at org.opengts.dbtools.DBAdmin.execCommands(DBAdmin.java:841)
at org.opengts.db.DBConfig._main(DBConfig.java:1246)
at org.opengts.db.DBConfig.main(DBConfig.java:1361)
I think it's pretty clear that I need to disable --skip-grant-tables, but I am new to MySQL and SQL in general. Recently, I followed a tutorial to reset the MySQL root password and I believe I enabled --skip-grant-tables through that. I've tried looking for solutions to disable this, but haven't come across anything.
Anyone able to help?

Just type: mysqladmin shutdown and then start MySQL service by running command: service mysql start.
:-)

Check your my.cnf file, you probably added that option in there.

Try this:
sudo systemctl set-environment MYSQLD_OPTS=""
(It worked for me.)

you must have stopped the server and run this
mysqld_safe --skip-grant-tables due to root pwd chg
so stop the server and start it normal with a start

Related

Mute a mysql warning message: mysql: [Warning] Using a password on the command line interface can be insecure

The MYSQL 5.6 & 5.7 keeps showing an annoying message
mysql: [Warning] Using a password on the command line interface can be insecure
in the vagrant/cygwin/ local environment's command line. If I run it in an Amazon EC2 instance with a command line, the MySQL won't return this warning at all. Is there any way to turn off this warning? Thanks!
I was also seeking for a solution for this . All I could come up with was:
mysql -u root -p"password" 2>/dev/null
I faced the same problem!
Have you seen this: https://dev.mysql.com/doc/refman/5.6/en/mysql-config-editor.html ?
You could easily save your credentials and use them with :
mysql -G your_conn_name

mysql wont start on Oracle Linux

I installed mysql following instructions on this link on my fresh installation of OEL 5. However when I try to start the mysql service with service mysqld start I keep getting
chown: `mysql:mysql': invalid user
chown: `mysql:mysql': invalid user
MySQL Daemon failed to start.
Starting mysqld: [FAILED]
When I try to check user's information with id mysql I get user does not exist and when I try to add user, it says user already exists!
If I try to start mysql or ecen check its version for instance, I get:
[root#localhost ~]# mysql -v
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Worst part is there is no mysql.sock file on my whole file system. I confirmed it by firing find / -name mysql.sock which returned empty result.
AM I missing some configuration step or something? I am absolutely clueless. Can someone please help me with this?
Please, which of the corresponding linux distribution are you using ? have you try to run it in sudo mode: sudo service mysqld start ? To see if mysql user have been created run cat /etc/passwd | grep 'mysql' or cat /etc/passwd; normally; it special user for specific purpose (here mysql administration).

MYSQL root password reset error

Running a server on Ubuntu, and needed to reset the mysql root password. Here is what I usually do (which usually seems to work):
Stopping the mysql server:
/etc/init.d/mysql stop
Starting the mysql server without password:
mysqld_safe --skip-grant-tables &
The error after running the command above:
[1] 14459
forge#test:~/dev.test.com$ 150809 15:12:01 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.
150809 15:12:01 mysqld_safe Logging to '/var/log/mysql/error.log'.
150809 15:12:01 mysqld_safe A mysqld process already exists
Any ideas? I have never seen this before.
EDIT: It may be worth mentioning I am using Forge for deployment.
You have to add the --skip-syslog option to the startup command, more details here:
Mysqld-safe
The problem was that Forge seems to re-start mysql by default if you turn it off in the command line...
By going into Forge, I was able to turn it off using the user-interface (Stop Services) for the particular server.

How to make mysql_install_db work?

I am new with MySql please help me out.
First to install MySql 5.5.7-rc i used this command->
sudo ./configure --prefix=/usr/local/mysql --with-plugin-partition --with-tcp-port=3308 --with-unix-socket-path=/tmp/mysql1.sock --with-debug
$sudo make
$sudo make install
Then when i am executing following command i am getting couple of errors.
$sudo ./mysql_install_db --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql/ --user=mysql
ERROR:::
Installing MySQL system tables...
connect: Connection refused
Installation of system tables failed! Examine the logs in
/usr/local/mysql/data for more information.
You can try to start the mysqld daemon with:
shell> /usr/local/mysql//bin/mysqld --skip-grant &
and use the command line tool /usr/local/mysql//bin/mysql
to connect to the mysql database and look at the grant tables:
shell> /usr/local/mysql//bin/mysql -u root mysql
mysql> show tables
Try 'mysqld --help' if you have problems with paths. Using --log
gives you a log in /usr/local/mysql/data that may be helpful.
Please consult the MySQL manual section
'Problems running mysql_install_db', and the manual section that
describes problems on your OS. Another information source are the
MySQL email archives available at http://lists.mysql.com/.
Please check all of the above before mailing us! And remember, if
you do mail us, you MUST use the /usr/local/mysql//scripts/mysqlbug script!
Then i tried '/usr/local/mysql//bin/mysql -u root mysql' and i found
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
But /tmp/mysql.sock and /var/run/mysqld/mysqld.sock don't exist. I checked it...
Please give some suggestion to overcome this problem.
even mysqld service is not being started..
"connect: Connection refused" means the server's not listening where it's expected to; I understand that an answer a year late might be a bit too late but one should start with what the distribution provides or the official builds and not a self-made source build of an RC of a quite complex product in the first place.
Maybe those hitting this question will find the accepted answer to that one useful: bash:scripts/mysql_install_db: No such file or directory

MySQL - Mac - Error 2002 - Can't connect to local... through socket

I had MySQL running fine on my Mac till earlier today when I installed homebrew and also updated my Path.
When I try to run mysql from my ternimal window now, I get the following error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
I can't connect MySQLAdmin either.
I can't even run Mysqld. The error I get when trying to run mysqld is that it can't create test file.
I also tried to telnet localhost 3306 and wasn't able to connect.
Any help would be appreciated as I am fairly new to Mac.
If it's homebrew installation try:
$ mysql.server start
Basically, all you have to do is:
Go to "System Preferences"
Then, if MySQL is installed you should see a "MySQL" icon in the "Other" section right at the bottom. Click on it.
Click on "Start MySQL Server"
You will now be able to start the MySQL command prompt without getting the "Can't connect..." error.
The mysql error (2002) is caused by the fact mysqld isn't running. The error you are seeing when starting mysqld is probably a permissions issue. Try starting mysqld as root or sudo'ing the command.
I'm user of osX 10.11.3 (El Capitan)
first of all, check your mysql version.
$ mysql --version
check the server is already running.
$ ps -ex | grep mysql
If you checked this following string, that means mysql server is already running.
=> mysqld_safe / --pid-file=#{path}
(The mysql pid file created when mysql server running to succeessfully. )
In that case, you have to stop mysql server.
$ mysql.server stop
and start your mysql server
$ mysql.server start
Starting MySQL
SUCCEESS!
and start(or restart) your mysql server
$ mysql.server start
$ mysql.server restart
If you failed to start mysql server, please leave me error message when you run mysql.server start
It may also be that the address to your sock-file is wrong in php.ini.
Open up the terminal, and run the following:
netstat -ln | grep mysql
This will show the correct path to your socket. Check it versus the address in php.ini. If it's wrong, then correct it.
Go to phpMyAdmin/config.inc.php edit the line
$cfg['Servers'][$i]['password'] = ''; to $cfg['Servers'][$i]['password'] = 'yourpassword';
And the last thing $cfg['Servers'][$i]['extension'] = 'mysql'; change this to $cfg['Servers'][$i]['extension'] = 'mysqli'; Now restart your server. and see .
This problem might occur due to setting of a password to root thus phpmyadmin is not able to connect to the mysql database.
I know this question is old but I fix this doing those followings commands
cd /usr/local/mysql
sudo ./bin/mysqld_safe
my_mac_password
Ctrl + Z
bg
Ctrl + D
quit the terminal
The problem is that I have to do this each time I reboot my mac.
Source: http://openclassrooms.com/courses/administrez-vos-bases-de-donnees-avec-mysql/installation-de-mysql