I installed MySQL (fresh) on my Ubuntu 18.04. And I'm having problems logging into the database. During installation there was no request for password and when I try  mysql -u root -p   the password was somehow set and I do not not how it is possible as it's a fresh installation.   Because I was confused, I tried removing MySQL packages as was somewhere suggested  sudo apt-get remove -y mysql-* sudo apt-get purge -y mysql-*   After this I made a new installation   sudo apt-get install mysql-server   but the result is the same. Not possible to login as root without password. I went through many discussions about root password reset and no success.   I tried to start mysql server with special init file via  mysqld --init-file=/home/me/mysql-init &amp;   the file consisted of   UPDATE mysql.user SET Password=PASSWORD('pass') WHERE User='root'; FLUSH PRIVILEGES;   result is   ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)   I also tried   sudo dpkg-reconfigure mysql-server-5.7   5.7. is correct version of my mysql server, but no result - as I read in another discussion this is possibly obsolete solution but I tried it anyway.   I also tried  sudo mysqld_safe --skip-grant-tables --skip-networking &amp; mysql -u root UPDATE user SET authentication_string=PASSWORD('newpass') WHERE user='root'; FLUSH PRIVILEGES;   but the new password does not work at all.   During installation there should be a request for root password, right? Or how can the password be set in the new installation? I'm quite new to Linux but I would expect that reinstall with purge should remove all settings and the new installation should be without root password?
35457
I used apt install mysql-server to install MySQL on Ubuntu 16.04 but during the installation, it did not ask for root password.  After installation I got ERROR 1045 when I tried to login as root and mysql_secure_installation threw the same error. I purged and autoremoved then reinstalled but it does not work.  How could i fix this? Can I set the root password if I didn't set it during installation?  This is my installation log:   The following additional packages will be installed:   libaio1 mysql-client-5.7 mysql-client-core-5.7 mysql-server-5.7   mysql-server-core-5.7 Suggested packages:   mailx tinyca The following NEW packages will be installed:   libaio1 mysql-client-5.7 mysql-client-core-5.7 mysql-server mysql-server-5.7   mysql-server-core-5.7 0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/17,9 MB of archives. After this operation, 160 MB of additional disk space will be used. Do you want to continue? [Y/n] y Preconfiguring packages ... Selecting previously unselected package libaio1:amd64. (Reading database ... 227144 files and directories currently installed.) Preparing to unpack .../libaio1_0.3.110-2_amd64.deb ... Unpacking libaio1:amd64 (0.3.110-2) ... Selecting previously unselected package mysql-client-core-5.7. Preparing to unpack .../mysql-client-core-5.7_5.7.12-0ubuntu1_amd64.deb ... Unpacking mysql-client-core-5.7 (5.7.12-0ubuntu1) ... Selecting previously unselected package mysql-client-5.7. Preparing to unpack .../mysql-client-5.7_5.7.12-0ubuntu1_amd64.deb ... Unpacking mysql-client-5.7 (5.7.12-0ubuntu1) ... Selecting previously unselected package mysql-server-core-5.7. Preparing to unpack .../mysql-server-core-5.7_5.7.12-0ubuntu1_amd64.deb ... Unpacking mysql-server-core-5.7 (5.7.12-0ubuntu1) ... Selecting previously unselected package mysql-server-5.7. Preparing to unpack .../mysql-server-5.7_5.7.12-0ubuntu1_amd64.deb ... Unpacking mysql-server-5.7 (5.7.12-0ubuntu1) ... Selecting previously unselected package mysql-server. Preparing to unpack .../mysql-server_5.7.12-0ubuntu1_all.deb ... Unpacking mysql-server (5.7.12-0ubuntu1) ... Processing triggers for libc-bin (2.23-0ubuntu3) ... Processing triggers for man-db (2.7.5-1) ... Processing triggers for systemd (229-4ubuntu4) ... Processing triggers for ureadahead (0.100.0-19) ... Setting up libaio1:amd64 (0.3.110-2) ... Setting up mysql-client-core-5.7 (5.7.12-0ubuntu1) ... Setting up mysql-client-5.7 (5.7.12-0ubuntu1) ... Setting up mysql-server-core-5.7 (5.7.12-0ubuntu1) ... Setting up mysql-server-5.7 (5.7.12-0ubuntu1) ... update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode Checking if update is needed. This installation of MySQL is already upgraded to 5.7.12, use --force if you still need to run mysql_upgrade Setting up mysql-server (5.7.12-0ubuntu1) ... Processing triggers for libc-bin (2.23-0ubuntu3) ...
15912
Im trying to install mysql and I get the error: mysql_upgrade: Got error: 1045: Access denied for user 'debian-sys-maint'@'localhost' (using password: YES) while connecting to the MySQL server  After some searching, I find this is perhaps giving access to debian-sys-maint, so I did this: sudo cat /etc/mysql/debian.cnf  Then set the debian password in mysql: mysql -u root -p &lt;password&gt; GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'password-here';  Then I restart: sudo /etc/init.d/mysql restart  And try and configure again: sudo dpkg --configure -a  I get the same error.
7858
I've been managing server installations both on and off Ubuntu flavor for some time - I've become quite adjusted to /etc/init.d/ for restarting servcies. Now I get this message:  root@tatooine:~# /etc/init.d/mysql status Rather than invoking init scripts through /etc/init.d, use the service(8) utility, e.g. service mysql status  Since the script you are attempting to invoke has been converted to an Upstart job, you may also use the status(8) utility, e.g. status mysql mysql start/running, process 14048   This seems to have been brought about in the latest LTS of Ubuntu - why? What's so bad about /etc/init.d/ and what/is there a difference between service and /etc/init.d/?
74563
I'm running Ubuntu Server 12.04, and I want to enable SSL connections to MySQL.  I've generated the following keys/certs files with OpenSSL:   ca-cert.pem server-cert.pem server-key.pem   I stored these at /etc/mysql, then added added the following lines to /etc/mysql/my.cnf:  ssl-ca=/etc/mysql/ca-cert.pem ssl-cert=/etc/mysql/server-cert.pem ssl-key=/etc/mysql/server-key.pem   Next, I restarted the server with sudo service restart mysql.  However, this doesn't seem to enable SSL. Within a mysql session:  mysql&gt; show variables like '%ssl%'; +---------------+----------------------------+ | Variable_name | Value                      | +---------------+----------------------------+ | have_openssl  | DISABLED                   | | have_ssl      | DISABLED                   | | ssl_ca        | /etc/mysql/ca-cert.pem     | | ssl_capath    |                            | | ssl_cert      | /etc/mysql/server-cert.pem | | ssl_cipher    |                            | | ssl_key       | /etc/mysql/server-key.pem  | +---------------+----------------------------+   Any ideas what I'm missing? Thanks
75201
I wanted to get a look at MySQL 5.6 on Ubuntu 14.04 just out of curiosity. And based on  it certainly looked like installation should be simple and straightforward. So I fired up an AWS EC2 micro server running Ubuntu 14.04 (64-bit), logged into my pristine instance (via PuTTY), and issued the following commands:  $ sudo apt-get update $ sudo apt-get build-dep mysql-server-5.6 $ sudo apt-get install mysql-server-5.6   (The first two commands were desperation moves, since simply running apt-get install alone had previously not worked. But even with all three commands, the install step still did not work.)  At the point where I expected, based on the article referenced above, to see this output from the final command:  mysql start/running, process 2355   Setting up libhtml-template-perl (2.95-1) ...   Setting up mysql-common-5.6 (5.6.16-1~exp1) ...   Processing triggers for libc-bin (2.19-0ubuntu6) ...   Processing triggers for ureadahead (0.100.0-16) ...     I got this instead:  start: Job failed to start   invoke-rc.d: initscript mysql, action "start" failed.   dpkg: error processing package mysql-server-5.6 (--configure):    subprocess installed post-installation script returned error exit status 1   Setting up libhtml-template-perl (2.95-1) ...   Setting up mysql-common-5.6 (5.6.16-1~exp1) ...   Processing triggers for libc-bin (2.19-0ubuntu6) ...   Processing triggers for ureadahead (0.100.0-16) ...   Errors were encountered while processing:    mysql-server-5.6   E: Sub-process /usr/bin/dpkg returned an error code (1)   Can anyone see what went wrong?
32133
I'm running in circles currently, trying to fix some mysql problem.  I couldn't use apt-get for a while now, because it always stuck at the line Setting up mysql-server-5.6 (5.6.27-0ubuntu0.15.04.1) ... and didn't let me do anything. So I tried to reinstall mysql, purging it. While I was able to remove mysql-server and mysql-client eventually, I'm still unable to purge mysql-common. Obviously, I managed to corrupt something, but how can I get my system back and running at this point?  ...:~# apt-get purge mysql-common Reading package lists... Done Building dependency tree        Reading state information... Done The following packages will be REMOVED:   mysql-common* 0 upgraded, 0 newly installed, 1 to remove and 5 not upgraded. After this operation, 0 B of additional disk space will be used. Do you want to continue? [Y/n] Y (Reading database ... 423600 files and directories currently installed.) Removing mysql-common (5.6.27-0ubuntu0.15.04.1) ... Purging configuration files for mysql-common (5.6.27-0ubuntu0.15.04.1) ... update-alternatives: error: /var/lib/dpkg/alternatives/my.cnf corrupt: invalid status dpkg: error processing package mysql-common (--purge):  subprocess installed post-removal script returned error exit status 2 Errors were encountered while processing:  mysql-common E: Sub-process /usr/bin/dpkg returned an error code (1)   -  ...# sudo dpkg -P --force-all mysql-common (Reading database ... 424733 files and directories currently installed.) Removing mysql-common (5.6.27-0ubuntu0.15.04.1) ... Purging configuration files for mysql-common (5.6.27-0ubuntu0.15.04.1) ... update-alternatives: error: no alternatives for my.cnf dpkg: error processing package mysql-common (--purge):  subprocess installed post-removal script returned error exit status 2 Errors were encountered while processing:  mysql-common   -  ...:~# lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description:    Ubuntu 15.04 Release:    15.04 Codename:   vivid   My goal is to just get it back and running again (mysql).
37286
I have followed this  to install MySQL but after successfully installed MySQL, I could not access database.     ERROR 1698 (28000): Access denied for user 'root'@'localhost'
3728
I have a MySQL database that I "inherited" and I was not given the admin credentials.  I do however have access to the box that it runs on.  Is there a way to either recover the admin credentials or create new ones?
18273
I tried mysql in my command line :   I get:  The program 'mysql' is currently not installed.  You can install it by typing: sudo apt-get install mysql-client-core-5.5   But when I do:  sudo apt-get install mysql-client-core-5.5   But I get:  Reading package lists... Done Building dependency tree        Reading state information... Done mysql-client-core-5.5 is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 47 not upgraded.   How should I proceed?
83653
Question: What is the best way to recover mysql (or worst case: migrate away) from a "chmod -R 777 /" with databases intact?  System: Ubuntu 12.04 LTS MySQL 5.5.24 64 bit Amazon EC2 cloud server.  Background: Attempting to recover (or at least recover data from) a system which had this done to it:        chmod -R 777 /   No point in worrying about the why.  It was a manager with too much access and too little experience who likes to swim in deep waters.  It was a pure accident on his part, not actually meaning to hit enter when he did.  I have recovered much of the system, but am really hung up on getting mysql working again.  I have already worked through such pages as:         Have already done this:        sudo chmod 644 my.cnf     chown mysql:mysql my.cnf   At which point attempting to start mysql:        sudo service mysql start   Produces this output in syslog:      Apr 12 20:51:42 ip-10-10-25-143 kernel: [18632541.774742] type=1400 audit(1365799902.306:41): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=18210 comm="apparmor_parser"     Apr 12 20:51:42 ip-10-10-25-143 kernel: [18632541.964496] init: mysql main process (18214) terminated with status 1     Apr 12 20:51:42 ip-10-10-25-143 kernel: [18632541.964542] init: mysql main process ended, respawning     Apr 12 20:51:43 ip-10-10-25-143 kernel: [18632542.959796] init: mysql post-start process (18215) terminated with status 1     Apr 12 20:51:43 ip-10-10-25-143 kernel: [18632543.002041] type=1400 audit(1365799903.534:42): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=18238 comm="apparmor_parser"     Apr 12 20:51:43 ip-10-10-25-143 kernel: [18632543.098490] init: mysql main process (18242) terminated with status 1     Apr 12 20:51:43 ip-10-10-25-143 kernel: [18632543.098536] init: mysql main process ended, respawning     Apr 12 20:51:43 ip-10-10-25-143 kernel: [18632543.140706] init: mysql post-start process (18244) terminated with status 1     Apr 12 20:51:43 ip-10-10-25-143 kernel: [18632543.158681] type=1400 audit(1365799903.690:43): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=18258 comm="apparmor_parser"     Apr 12 20:51:43 ip-10-10-25-143 kernel: [18632543.285087] init: mysql main process (18262) terminated with status 1     Apr 12 20:51:43 ip-10-10-25-143 kernel: [18632543.285133] init: mysql respawning too fast, stopped   What I read from that is mysql is terminating with a status 1, and it loops a few times trying to start up and gets stopped from doing that after too many attempts.  I've looked into status 1 but haven't found solutions that seem applicable.
56751
I'm using Ubuntu desktop 16.04 (upgraded from 15.10).  I had installed phpmyadmin from by apt-get install phpmyadmin. It works if I go to localhost/phpmyadmin but I cannot log into it as root.  I have searched a lot for it. I have found many sources in which they suggest to alter /etc/phpmyadmin/config.inc.php and replace the user and password with 'root' and '' (empty for password). But my config.inc.php is different from theirs. For example in my file, there is no line for user and password and it seems it gets it automatically from another file which is /etc/phpmyadmin/config-db.php. Despite this, I have changed the user and password in that file, but now I get this error:  #1698 - Access denied for user 'root'@'localhost'   What I should do?    Phpmyadmin Version: 4.5.4.1deb2ubuntu1 mysql  Ver 14.14 Distrib 5.7.12, for Linux (x86_64) using  EditLine wrapper
10760
My overall upgrade went well, but I am left with a critically lingering issue of mysql-server not being able to install itself, and nothing I am trying gets it to work.  This is the error I see when trying to install/reinstall it:  Setting up mysql-server-5.7 (5.7.11-0ubuntu6) ... Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details. invoke-rc.d: initscript mysql, action "start" failed. dpkg: error processing package mysql-server-5.7 (--configure):  subprocess installed post-installation script returned error exit status 1 dpkg: dependency problems prevent configuration of mysql-server:  mysql-server depends on mysql-server-5.7; however:   Package mysql-server-5.7 is not configured yet.  dpkg: error processing package mysql-server (--configure):  dependency problems - leaving unconfigured No apport report written because the error message indicates its a followup error from a previous failure.                    Processing triggers for systemd (229-4ubuntu4) ... Processing triggers for ureadahead (0.100.0-19) ... Errors were encountered while processing:  mysql-server-5.7  mysql-server E: Sub-process /usr/bin/dpkg returned an error code (1)   I've tried completely removing it, though doing so attempts to install MariaDB because of dependencies (?). Any suggestions on what I can do to fix this would be most welcome.  EDIT: Looks like I'm not the only one:
65043
Apparently, I can connect to MySQL (at least from my localhost) without having to provide any username or password. I can even put anything as username, as long as the password is empty. I have access to the information_schema and test databases. I can create tables. If I run SELECT USER() it returns the proper value randomstring@localhost, where the random string is whatever I used for username when I connected.  The mysql.user table contains root@localhost, root@127.0.0.1, @localhost and pma@localhost. I manually set encrypted passwords to all the records (UPDATE user SET password=...) and only root has any privileges, the other two records have "N" for all privileges. That record with the empty username looks suspicious, but I don't think it has anything to do with this and I think it was there from the beginning.  To make matters worse, if I add a user with a password, I can only connect using empty string as password (just like if I put anything as username). If I try to connect using the username I created and password I supplied when creating it (CREATE USER .. IDENTIFIED BY ..) it doesn't work.  Does anyone know what is wrong and how I can fix this?  Note: I am using MySQL 5.5.16 for Windows, provided by the XAMPP package.
103073
I've taken over a system using postgres. When logging in, if I use ...  sudo -u postgres psql postgres   ...it does NOT ask for a password. However, if I do ...  psql -U postgres -h localhost postgres   ... it asks for the password.   Why?  How is this difference configured? Can it be configured for a different user to login this way?  (NOTE: user postgres is NOT in the sudoers file, or in the sudo group.
84550
I have MySQL password saved on a file foo.php, for example P455w0rd, when I try to use it:  $ cat foo.php | grep '$dbpwd=' | cut -d '"' -f 2 | mysql -U root -p mydb -h friendserver Enter password: (holds)  $ echo P455w0rd | mysql -u root -p mydb -h friendserver Enter password: (holds)   Both option still ask for password, what's the correct way to send password from stdin?
22164
I just can't login to PhpMyAdmin anymore, it says bad logins. PHP works perfectly. Please help. Thank you.  2002 Cannot log in to the MySQL server Language Log in Username: Password:  Connection for controluser as defined in your configuration failed.
96562
I tried restarting the Mysql server but its not working for me. I am sure the server is running and the permissions on the folder /var/lib/mysql/ are correct (777).  When i tried to open the file mysql.sock, its giving me an error saying the file may be corrupt.  Please help me to log on to the mysql server.