When you're installing MySQL you're asked to enter the root
password that you want to set for the database. In the status code you've listed above you're logging in as charles@localhost
and not root
. That's the reason why it's not asking for the password you set during installation.
If you're logging in to MySQL using the root
account then you can do all the things you want.
Simply type:
mysql -p -u root
and it'll ask you for the root password. Now you're "in" the system with full access. You can then create databases using:
CREATE DATABASE MyNewDatabase;
If you have a user that you want to give access to this new database you can type:
GRANT ALL ON MyNewDatabase.* TO 'charles'@'localhost';
When this is done you should be able to login as charles and also have full access to the newly created database.
ok, i best solution which suited me well.
for being cautious in choosing the above solutions provided in my question above..
(cuz the solutions didn't guarantee 100% that my data would be intact), i made a backup for my drupal database folder just in case.
chose solution (2), which is adding the force_recovery..but no luck in fixing the problem..
so i went to the location of the corrupted file in "C:\xampp\mysql\data\bitnami_drupal7", and moved the corrupted file to another folder (NOTE: i did not delete the corrupted file).
then started mysql service, and viola! my drupal was back to life again.
and i was able to access phpmyadmin with sql queries.
(back then, mysql couldn't execute sql queries because it was in a state where its about to crash).
i went straight to the cache tables of drupal to clear them..
(back then, i wanted to clear drupals' cache since the error started, cuz ever since i knew that mysql crashes because of a table in drupal; but mysql couldn't have enough time to execute sql queries in phpmyadmin, again cuz of the the crash).
hence, after clearing all drupal cache at "bitnami_drupal7" with this code:
TRUNCATE TABLE cache;
TRUNCATE TABLE cache_block;
TRUNCATE TABLE cache_bootstrap;
TRUNCATE TABLE cache_field;
TRUNCATE TABLE cache_filter;
TRUNCATE TABLE cache_form;
TRUNCATE TABLE cache_image;
TRUNCATE TABLE cache_menu;
TRUNCATE TABLE cache_page;
TRUNCATE TABLE cache_path;
TRUNCATE TABLE cache_token;
TRUNCATE TABLE cache_update;
then, i replaced the corrupted file back again to try if it becomes recognized or not, and started mysql..and it worked!!
mysql never crashed again and complain about that file being corrupted anymore, and that saved me from deleting or affecting any data.
Best Answer
May be lame to do this but worthy to double check the username and password and ip. "Copy paste the exact connect string in commandline"
Triage more by only keeping DB connection from app/web server and check the DB connectivity functionality and see if the issue repeats. If yes, do the same from someother host with same app/web interface server version. [with this we can be sure that the host is no problem] .