ERROR 1045 (28000) Access denied for user 'root'@'localhost'. Symfony. Bitnami WAMP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gintare
    New Member
    • Mar 2007
    • 103

    ERROR 1045 (28000) Access denied for user 'root'@'localhost'. Symfony. Bitnami WAMP

    I sit already 2h browsing internet and i am not able to find a solution. Could you please help me.

    Bitnami WAMP, Symfony

    1) I am not able to login to MYSQL through console
    using command: mysql -u root -p
    using command: mysql -h localhost -u root -p
    using command: mysql -h localhost -u root -p -P 3006
    using command: mysql -h 127.0.0.1 -u root -p
    using command: mysql -h 127.0.0.1 -u root -p -P 3006
    i am getting the same error in all cases: ERROR 1045 (28000) Access denied for user 'root'@'localho st' (using password: NO)

    2) I am not able to login to PhpMyAdmin, using user "root" and empty field for password.

    3) I am not able to generate entity from console in Symfony application. I am getting error:[PDOException] SQLSTATE[HY000] [1045] Access denied for user 'root'@'localho st' (password: NO)


    config.inc.php
    in folder
    C:\Bitnami\wamp stack-5.4.36-0\apps\phpmyadm in\htdocs\confi g.inc.php
    contains the following lines:
    Code:
    $cfg['Servers'][$i]['host'] = 'localhost';
    $cfg['Servers'][$i]['user'] = 'root';
    $cfg['Servers'][$i]['password'] = '';
    $cfg['Servers'][$i]['port'] = '3306';
    I also tried 127.0.0.1 instead of localhost.

    parameters.yml
    in folder
    C:\Bitnami\wamp stack-5.4.36-0\sym_prog\mypr oject\app\confi g
    contains the following lines:
    Code:
    parameters:
        database_driver: pdo_mysql
        database_host: 127.0.0.1
        database_port: null
        database_name: symfony
        database_user: root
        database_password: null
        mailer_transport: smtp
        mailer_host: 127.0.0.1
        mailer_user: null
        mailer_password: null
        locale: en
        secret: 50cbd9b37723fsdfgd9202880589f27baa6df5b3dd
    i also tried "localhost" instead of 127.0.0.1.

    How to make user 'root'@'localho st' to be accepted?
  • gintare
    New Member
    • Mar 2007
    • 103

    #2
    When i try to use command mysql in console, i am geting error that 'ODBC'@'localho st' can not connect.


    c:\Bitnami\wamp stack-5.4.36-0>mysql
    ERROR 1045 (28000): Access denied for user 'ODBC'@'localho st' (using password: NO)

    Comment

    • Luuk
      Recognized Expert Top Contributor
      • Mar 2012
      • 1043

      #3
      I think your root password is not matching with what you provide during your attempts...

      Try resetting the password for 'root'

      see: http://dev.mysql.com/doc/refman/5.0/...rmissions.html

      Comment

      • gintare
        New Member
        • Mar 2007
        • 103

        #4
        C:\Bitnami\wamp stack-5.4.36-0\apps\phpmyadm in\htdocs\confi g.inc.php

        $cfg['Servers'][$i]['password'] = '';
        $cfg['Servers'][$i]['nopassword'] = true;
        $cfg['Servers'][$i]['AllowNoPasswor d'] = true;

        It means that i do not need password to login.

        Comment

        • Luuk
          Recognized Expert Top Contributor
          • Mar 2012
          • 1043

          #5
          No, it meand that phpmyadmin is configured not to as for as password.......

          But how it MySQL configured????

          Comment

          • gintare
            New Member
            • Mar 2007
            • 103

            #6
            I use command: mysql --help --verbose
            It output the following directories and filenames:
            Code:
            Default options are read from the following files in the given order:
            C:\Windows\my.ini 
            C:\Windows\my.cnf 
            C:\my.ini 
            C:\my.cnf 
            c:\bitnami\wampstack-5.4.36-0\mysql\my.ini 
            c:\bitnami\wampstack-5.4.36-0\mysql\my.cnf
            I could not find:
            C:\my.ini
            C:\my.cnf
            C:\Windows\my.i ni
            C:\Windows\my.c nf
            c:\bitnami\wamp stack-5.4.36-0\mysql\my.cnf
            I found only
            c:\bitnami\wamp stack-5.4.36-0\mysql\my.ini
            which does not contain password option. The contents without most of comments:
            Code:
            [mysqldump]
            max_allowed_packet=16M
            
            [isamchk]
            key_buffer_size=20M
            sort_buffer_size=20M
            read_buffer=2M
            write_buffer=2M
            
            [myisamchk]
            key_buffer_size=20M
            sort_buffer_size=20M
            read_buffer=2M
            write_buffer=2M
            
            [mysqlhotcopy]
            
            [mysqladmin]
            user=root
            port=3306
            # set basedir to your installation path
            basedir=C:/Bitnami/WAMPST~1.36-/mysql
            # set datadir to the location of your data directory
            datadir=C:/Bitnami/WAMPST~1.36-/mysql\data
            port=3306
            #skip-locking
            key_buffer_size=16M
            max_allowed_packet=16M
            table_cache=64
            sort_buffer_size=512K
            net_buffer_length=8K
            read_buffer_size=256K
            read_rnd_buffer_size=512K
            myisam_sort_buffer_size=8M
            bind-address=127.0.0.1
            Finally i have added line to
            c:\bitnami\wamp stack-5.4.36-0\mysql\my.ini
            I have tried several combinations, restarting MySQL server each time i make change:
            password="some"
            password='some'
            password=some
            password=none
            password=""
            password=''

            I check if this works by command
            mysql -u root -p
            But i am still getting error "ERROR 1045 (28000): Access denied for user 'root'@'localho st'".

            I also tried command:
            mysql -u root -p "some"
            (with "", '' and without quotes), but it outputs help.
            According

            This command works only for the first time. If password already exists somewhere, this command is not working.

            According,

            Code:
            (1) Stop the server: /etc/init.d/mysql stop 
            (2) Start the mysql daemon: # mysqld_safe –skip-grant-tables
            (3)* While its running, open another terminal and login to mysql
            # mysql -u root (hit enter)
            (4) Now you are logged in.
            mysql>use mysql;
            mysql>update user set password=PASSWORD(“YOUR_NEW_PASS”) where User=’root';
            you should see the output: Query ok etc.
            mysql>flush privileges;
            mysql>quit
            (5) stop the server: /etc/init.d/mysql stop
            (6) *Confirm that no mysql processes are still running (in my case they were and made the server fail to start). To check this: run this
            ps ax | grep mysql
            Now kill the process IDs of any mysql still running in the background using kill PID
            e.g. kill 4425. Do not use kill -9 as this may crash the database entirely!!
            Confirm no mysql process is still running: ps ax | grep mysql
            (7) Then start the server: /etc/init.d/mysql start
            (8) login with your new password: mysql -u root -p
            But in my case, seems mysqld is not working.
            I have found
            C:\Bitnami\wamp stack-5.4.36-0\mysql\bin\mys qld.exe
            Using command: mysqld --verbose --help
            outputs range of commands "–skip-grant-tables" including, but there is a notice FALSE on the same line.
            I stop mysql server from WINAMP options window, than i run: mysqld –skip-grant-tables
            than i open another termnal and try to login using: mysql -u root
            I am getting "ERROR 1045 (28000): Access denied for user 'root'@'localho st' (using password: NO)"


            How to configure(set) password for root in mysql?
            Should i create *.cnf file?

            Actually the main problem is that i can not create tables in Symfony. Most probably symfony use "C:\Bitnami\wam pstack-5.4.36-0\sym_prog\mypr oject\app\confi g\parameters.ym l" parameters and overwrites mysql settings? But it can not overwrite because it tries to overwrite the wrong file, which does not exists?

            Comment

            • Luuk
              Recognized Expert Top Contributor
              • Mar 2012
              • 1043

              #7
              Because you configured phpmyadmin to NOT use a password for root,
              You should make sure you can use MySQL with :
              C:\> MySQL -u root

              If above is failing, than try, (and specify the correct paasword):
              C:\> MySQL -u root -p
              If you need this last line, than your setup of MySQL is not in line with the setup of phpmyadmin.

              Comment

              • gintare
                New Member
                • Mar 2007
                • 103

                #8
                I do not agree that settings:
                $cfg['Servers'][$i]['nopassword'] = true;
                $cfg['Servers'][$i]['AllowNoPasswor d'] = true;
                affects how root logins.

                The question is how to reset root password if it is forgotten or how to retrieve it?

                Finally, i have reinstalled Bitnami WAMP, i was asked to create root password on the first step and now everything works using this password.

                But if somebody could tell how to reset MYSQL root password or how to retrieve it if i forget, could you please write.

                mysql Ver 14.14 Distrib 5.5.42, for Win32 (x86)
                installed with Bitnami WAMP stack 5.4.38-0

                Comment

                • gintare
                  New Member
                  • Mar 2007
                  • 103

                  #9
                  All discussion above complains about several different things: that i can not login to mysql from command line as root, that i can not login to PhPMyAdming, that i can not generate tables with Symfony.

                  Summarizing, the question is "how to reset MYSQL root password or how to retrieve it if i forget"?

                  mysql Ver 14.14 Distrib 5.5.42, for Win32 (x86)
                  installed with Bitnami WAMP stack 5.4.38-0

                  Comment

                  • Luuk
                    Recognized Expert Top Contributor
                    • Mar 2012
                    • 1043

                    #10
                    "Summarizin g, the question is "how to reset MYSQL root password or how to retrieve it if i forget"?"

                    see my first reply, the link is:

                    Comment

                    • gintare
                      New Member
                      • Mar 2007
                      • 103

                      #11
                      THANKS, NOW IT WORKS!!!
                      I did not read your first reply carefully, i am sorry!

                      Just several notices.
                      After BITNAMI WAMP INSTALLATION
                      1) MySQL server is not running as a service ( "From the Start menu, select Control Panel, then Administrative Tools, then Services").
                      2) MySQL service is not listen in Task Manager Services (Ctl+Al+Del on Windows)
                      3) It is possible to stop the service only though WAMPStack Manager Tool.
                      4) Trying the given command "mysqld-nt" outputs error: "c:\>mysqld-nt --init-file=C:\\mysql-init.txt
                      'mysqld-nt' is not recognized as an internal or external command, operable program or batch file."

                      5)Trying the modified command "mysqld -nt" outputs warning but works, i.e changes root password: "c:\>mysqld -nt --init-file=C:\\mysql-init.txt
                      150308 15:05:44 [Warning] option 'new': boolean value 't' wasn't recognized. Set to OFF."""

                      Comment

                      Working...