Unknown system variable when opening phpmyadmin [duplicate] - mysql

This question already has answers here:
#1193 - Unknown system variable 'lc_messages' when trying to login to phpmyadmin
(7 answers)
Closed 5 years ago.
Error
SQL query: Edit Edit
SET lc_messages = 'en_US';
MySQL said: Documentation
1193 - Unknown system variable 'lc_messages'

I had the same problem and here is how I fixed it:
Upgraded mysql to latest version: http://www.tecmint.com/install-latest-mysql-on-rhel-centos-and-fedora/
After the upgrade mysql service couldn't start. Here's the fix:
mysqld_safe --skip-grant-tables
mysql_upgrade

Go to Shell (In xampp at right corner, third one)
Enter
mysql // Hit enter
SET lc_messages = 'en_US'; //Hit enter
Restart Mysql

Related

Run sql in Dockerfile starting from exisiting MySQL db image [duplicate]

This question already has answers here:
How to create populated MySQL Docker Image on build time
(6 answers)
How can I initialize a MySQL database with schema in a Docker container?
(11 answers)
Closed last month.
I am trying to build a new mysql image from an existing one, and then insert some records into the database as part of the build process to create the new image (i.e. new mysql image = old mysql image + extra table records).
I am not able to add an sql file that contains my insert queries to /docker-entrypoint-initdb.d, cause that is not executing the scripts inside that directory (because the starting image already has a /var/lib/mysql dir available?).
I have tried to do something like the following instead:
FROM my.registry/starting-mysql-img:latest
ADD insert-queries.sql /tmp
RUN mysql -u root mydb < /tmp/insert-queries.sql
But I get a
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) error.
What am I doing wrong / is there an alternative way to achieve my I am looking for?

MySQL lost root password [duplicate]

This question already has answers here:
MySQL: How to reset or change the MySQL root password?
(36 answers)
Closed 2 years ago.
This seems like a simple question but has caused me endless hours of frustration. It is only a small box inside the house that I am using for playing around.
I've tried the skip-grant-tables version and used the authentication_string field rather than the password version that is still knocking around. I've also tried the init-file method but no joy.
If I use the skip-grant-tables version and use the line:
update user set authentication_string=password('whywontitwork') where user='root';
The result I get is:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('whywontitwork') where user='root'' at line 1
I don't understand (at all) what is wrong with the syntax. It is driving me mad for what should be a tiny little issue (I think). Does anybody have any ideas? Thanks in advance.
MySQL Ver 8.0.21-0ubuntu running on Ubuntu 20.04.
Function PASSWORD() is not working in MySql 8.0. You can use other encryption functions: LINK
How to reset root password in MySQL > 8.0: LINK
try with
ALTER USER 'root'#'localhost' IDENTIFIED BY 'NewPassword';
you can also create mysql-init file and apply this command by file
mysqld --init-file=/home/me/mysql-init &

Error on trying to change password in mysql

I forgot the password for mysql, so i was trying to change it using following steps -
1) Stop Mysql server
2)Start server in safe mode by using sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables
3) Open mysql command line using sudo /usr/local/mysql/bin/mysql -u root
4) Update password using UPDATE mysql.user SET authentication_string=PASSWORD('NewPassword') WHERE User='root';
But on this step i am getting the following error message -
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '('NewPassword') WHERE User='root'' at line 1
Can someone tell how to resolve this error?
On 8.0.15 (maybe already before that version) the PASSWORD() function does not work, as mentioned in the comments below. You have to use:
UPDATE mysql.user SET authentication_string='password' WHERE User='root';
Original answer here
As problem states clearly, its incorrect syntax.
You should be using official MYSQL procedure to reset password, that includes create text file with command and then restarting the mysqld with text file input with mysqld --init-file=/home/me/mysql-init &' command.
Refer official root password reset options for unix [here][1].
[1]https://dev.mysql.com/doc/refman/8.0/en/resetting-permissions.html

how to use command line to connect mysql database, and the database name with Illegal character ‘-’? [duplicate]

This question already has an answer here:
MySQL schema name with dash does not allow me to execute command line query
(1 answer)
Closed 7 years ago.
Recently we want to backup mysql data to other database.I have found a problem,
The old database name have Illegal character ‘-’, and I have use command line to connect the database, and I change the database, like: use test-server, but have error as
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-server' at line 1
This is because of the Illegal character ‘-’, how can I escape this character?
BTW: we can connect database by navicat, but I want login to mysql server to backup.
Try this
mysql --user=user_name --password=your_password 'db-name'

MySQL server instance will never start. Mac OS Lion [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I installed MySQL using the DMG file (http://dev.mysql.com/downloads/mysql/), and I installed the MySQL_etc.pkg, the MySQLStartUpItem.pkg and the MySQL.prefPane items.
Every time I try to start mysql from the command line I get the message:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)
Thanks to various posts on stackoverflow I discovered that this was because MySQL was not running. So I go to the MySQL pane in System Preferences and sure enough "The MySQL Server Instance is stopped". I click "Start MySQL Server" and I get the spinning beach ball for 2 minutes, then nothing happens. The MySQL Server Instance stays stopped.
If I restart my computer then I can go to the MySQL pane and it tells me that "The MySQL Server Instance is running". And sure enough mysql -v at the command line tells me my MySQL connection id, and that I have server version 5.6.10. But then if I leave mysql by typing exit the server instance stops, and I can only restart it by restarting my computer!
Any ideas? I haven't even been able to run MySQL for long enough to set passwords, let along create a database!
After an afternoon of false leads (I don't mean to sound ungrateful, all suggestions were followed up and I'm thankful for all advice), I uninstalled all traces of MySQL and reinstalled an older version, following the advice on this blog: http://soatechlab.blogspot.com/2011/01/completely-remove-mysql-on-mac-os-x.html
It appears to be working now.
Try:
prompt$ sudo mysqld -u root <secure password goes here!>
Note the sudo: MySQL wouldn't let me start up the server without root access to both the computer and MySQL itself. Also note that the program is mysqld, not mysql.
The command varies depending on how you installed MySQL. Try this first:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
If that fails:
cd /usr/local/mysql
sudo ./bin/mysqld_safe
(Enter your password, if necessary)
(Press Control-Z)
bg
I havent' tried this, but check this out if you are working with MAMP and php:-
http://twob.net/journal/fix-for-mamp-mysql/
Maybe even try a re-install and follow these docs:-
http://dev.mysql.com/doc/refman/5.6/en/macosx-installation.html
In addition, plenty of brainstorming on this page:-
https://stackoverflow.com/questions/4788381/getting-cant-connect-through-socket-tmp-mysql-when-installing-mysql-on-m