MySql Install on Ubuntu root issue - php

Setting. I'm running Ubuntu 15.04 on a custom machine with an existing PHP / Apache / Sqlite setup. I recently installed MySql to fiddle around with Laravel a bit. It was working perfectly until I wasn't paying attention and did something incredibly stupid. I intended to export all of the user's privileges to a new database, was in a hurry, and instead clicked the button to dump all users. So, yeah. Complete dumped every user in MySql, including root. Obviously I was unable to log back in with PhpMyAdmin, because no root user. Since this was just a testing install I went ahead and purged MySql and re-installed, thinking it would just go through the install process again. NOPE. I've uninstalled / reinstalled using the terminal, synatpic, and Ubuntu Software Center. In each case the install of MySql client server just breezes through without even asking for a root user. I can't even check status to see if the server is running without getting an unauthorized error. I would really like to get this fixed, but without uninstalling apache2 and php. Any help would be greatly appreciated.
After yet another purge / install cycle I have mysql mostly working again. I can log in as root from the command line, and I am able to log in via PhpMyAdmin, for the most part. Unfortunately, while I seem to still have all of the necessary PhpMyAdmin functionality the page itself throws several iterations of the following error:
Connection for controluser as defined in your configuration failed.
I've researched this error and none of the conditions that are said to cause it exist in my system.

First try this.
mysql -u root -p password
if first method does not work then use following method to reset your MySQL password.
Check your version of the MySQL database.
apt-cache policy mysql-server
Start configuration setting of the MySQL database.
sudo dpkg-reconfigure mysql-server-** . **
"replace ** . ** with your MySQL database version"
It will open a configuration prompt where you will can change password.
If both of the above methods fails then use this method as last resort.
Stop your MySQL database server
sudo /etc/init.d/mysql stop
Start demon process without grant table.
sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking
Start MySQL and flush the privilige.
mysql -u root
FLUSH PRIVILEGES;
Now set the password for the root user.
USE mysql
UPDATE user SET Password = PASSWORD('newpwd')
WHERE Host = 'localhost' AND User = 'root';

Related

How to fix a connection by web control panel Froxlor to MySQL?

I installed Apache2 and MySQL client/server and PHP8.1.2 manually. Ubuntu 22.04 successfully connected to the database from the terminal, changed the root password, exit.
Next, I tried to install the web control panel.
I first downloaded Froxlor from git https://github.com/Froxlor/Froxlor
to the /var/www/froxlor
master branch folder. Then I installed all the dependencies from the list, but this was not enough. The PHP application code gave out unsatisfied dependencies.
Here https://deb.froxlor.org/debian/pool/main/f/froxlor/ found the DEB package and installed it in the same folder through the terminal, satisfying all the dependencies with this - the code worked.
Then I started the installation. through the browser. By going to /index.php I am offered no options to go to ./install/, where I fill in all the relevant fields (maybe not correctly?) in the second window of the page and after clicking "submit" I get an error:
Checking MySQL-root access... SQLSTATE[HY000] [1698] Access denied for user 'root'#'localhost'
There seems to be a problem with the database-connection. Cannot continue. Please go back and check your credentials.
such an error crashes in the terminal if you connect to the database without "sudo", here I was confused. I have researched /install/lib/class.FroxlorInstall.php on the subject of at least some zatseki what should I do and still tried to add "sudo" in the file /tests/bootstrap.php in line 50
exec("sudo mysql -u root -p" . $rpwd . " froxlor010 " . dirname(DIR) . "/install/froxlor.sql");
but it didn't lead to anything. Maybe there is some similar experience, please tell me. Thx
P.S. I also tried to install via froxlor.phar, but my installation hung up at the moment of connecting to the database, perhaps the script was waiting for the password to be entered, but this was not reflected.
Oh, I solve it by my self.
It need to create file ../froxlor/lib/userdata.inc.php by this example:
<?php
// automatically generated userdata.inc.php for Froxlor
$sql['host']='localhost';
$sql['user']='froxlor012';
$sql['password']='PASS';
$sql['db']='froxlor';
$sql['ssl']['caFile']='';
$sql['ssl']['verifyServerCertificate']='0';
$sql_root[0]['caption']='Default';
$sql_root[0]['host']='localhost';
$sql_root[0]['user']='frox';
$sql_root[0]['password']='PASS';
$sql_root[0]['ssl']['caFile']='';
$sql_root[0]['ssl']['verifyServerCertificate']='0';
// enable debugging to browser in case of SQL errors
$sql['debug'] = false;
?>
also you need to create 'froxlor','froxlor012' and 'frox' users (step forward: dont foget to change the PASS's, it may not be empty, and to GRANT users to 'froxlor' database) and empty 'froxlor' database ( step forward: if you have no back up of DB you can take back up of this example https://www.dropbox.com/s/6guus4uxc9v2agf/froxlorbackup.sql?dl=0 ) in MySQL, then run in terminal:
sudo php /var/www/froxlor/install/scripts/config-services.php --froxlor-dir=/var/www/froxlor/ --create
sudo mysql -h localhost -u 'root' froxlor < /home/administrator/froxlorbackup.sql
so we have manualy install froxlor without any mistakes of installer. You will find user name froxlor with PASS in DB backup.

Apache and Mysql using Ubuntu mate

I'm new to Ubuntu. I tried to run a .php file and connect it to a database. Everything is on-set. I already imported the database in phpMyAdmin but every time I access my database,it returns an error
This page isn’t working localhost is currently unable to handle this
request. HTTP ERROR 500
Turns out, it seems like my database isn't running at all. In Windows I just open the XAMPP and click Apache and MySQL buttons. While in Ubuntu,
I have no idea on how to start or run MySQL and Apache. I already tried running commands on the terminal but it won't help. Someone has already installed it on this computer, I just don't how to run it and what web-server platform is this running.
How do I do it and how would I know that my database is running and accessible?
Try to connect your database and access database via command line.
mysql -u [username] -p
you can replace [username] with your real username of mysql like root
it will prompt for password so you are type yours like root
prompt will say
mysql>
now you need to list all databases to see is database exists or not
show databases;
it will list down all databases. you may verify is your exists or not
then you can select database by
use databasename;
and then run
show tables;
it will show all tables.
so you can verify that mysql working, database exists and tables are there or not.
Use this command it will start the database is you have it
systemctl mysql start
This should do the trick you need to have mysql database or maria db installed
Check by running this command in terminal after the first one
mysql
And you can also add argument like host and login
mysql -h (your host default is localhost) -u (user default is root) -p (password default is none)
Check your files access level
sudo chmod -R 777 "location of your file"

XAMPP manager can't start server on OS X but it work on terminal

First my english might be bad so if you understand what I mean but the sentence is not correct feel free to edit my post, and if you don't understand I'll try my best to explain better.
I installed XAMMP on my MyBook Air version 10.11.5. I can launch the application but in "Manage servers" when I press the "Start all" button all the status switched from "Stopped" to "Starting" and then return to "Stopped" after about 20 seconds. Here is the application log :
Starting MySQL Database...
Starting Apache Web Server...
/Applications/XAMPP/xamppfiles/apache2/scripts/ctl.sh : httpd started
Starting ProFTPD...
Checking syntax of configuration file
/Applications/XAMPP/xamppfiles/proftpd/scripts/ctl.sh : proftpd started
Two things here : the MySQL database doesn't send anything in return and it seem that for the log the servers are running. So maybe it was only a display problem on the "Manage servers" tab so I tried to go to the adress http://localhost but nothing.
After a lot of research and try the only topic who gives me what I want is this one : MySQL Database won't start in XAMPP Manager-osx
The command sudo /Applications/XAMPP/xamppfiles/bin/mysql.server startworks perfectly. So now I can start the MySQL server only. The I noticed something, here is the terminal log :
MacBook-Air:~ user$ sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start
WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.
To proceed, enter your password, or type Ctrl-C to abort.
Password:
Starting MySQL
. SUCCESS!
You can see I had to enter my session password. So my questions are simple :
Could the password be the problem for the XAMPP Manager ?
i.e. the manager try to launch the servers but encounter the password request and then failed to launch the servers.
If it's the case how can I give to XAMPP the access so the manager can launch on is own the servers without needed to use the terminal ?
Is there any command like the one below to launch also the PHP server if I can't fix the Manager problem ?
I promise I did research on this topic but I find nothing about this specific password (I was often redirected on starting session password...).
Thank you for reading and maybe for answering !
Yes because thats not the right way to start XAMPP.
You should do the following instead cd to your xampp application folder, there should be a executable file called xampp. The gui application is not that good, I've had various problems with it, I think the best thing to do is to start it via terminal.
The password is not the problem, its asking because it requires admin privileges to run it. Thats why you're using sudo.
Run the following command:
sudo ./xampp start
You can find the list of all xampp terminal commands by typing the following:
./xampp -h
For example you can start different 'modules' of the application separately e.g to start just apache.
sudo ./xampp startapache
I hope this helps.
Could it be something broken with the installer?
I had the same issue, but after downgrading to 7.0.5 everything works fine on El Capitan.

configuring phpmyadmin and mysql

i just installed xampp on my pc windows 7 64bit,it seems everything was successfully installed but when i click on phpMyAdmin i get an error like this on the image below
Check to see if MySQL is started and not just Apache/PHP.
Try disabling your firewall. If that works, look into properly creating a firewall rule for it.
In the future, these questions would be better posed in other venues (consider serverfault.com or webmasters.stackexchange.com)
Open the command line and type in:
mysql -u root -p
Enter the password (if no password set, leave off -p switch).
If you can get in, at least you know MySQL is running properly. So the fault is not there.
Check phpmyadmin's config.inc.php file. It could have wrong login mechanism set, the wrong username/password set, or is using a port number other than 3306 (default for MySQL).
Also consider trying some of the other wamp packages such as : WampServer, UniformServer, ZWamp, WampDeveloper (commercial)...
http://en.wikipedia.org/wiki/Comparison_of_WAMPs
You might have better luck there. Just make sure to uninstall, delete, and reboot first.

Cannot login with PhpMyAdmin on Mac os x 10.6. Does anyone know a fix to this error message?

I just reinstalled Mac Os X 10.6.2 and had to reinstall/update my MySQL server.
I run phpMyAdmin inside my localhost and I used to be able to login without a hitch.
Since the updated (latest version MySQL 5.1.45 & PMA 3.3.1) versions I only get the following error when trying to login with phpMyAdmin:
phpMyAdmin - Error
Cannot start session without errors, please check errors given in your PHP
and/or webserver log file and configure your PHP installation properly.
The only thing I noticed is that mcrypt cannot be loaded (this has always been the case, no idea what to do to install this..) but this has never been a problem before.
If anyone know what to do here that would be really appreciated.
Thanks for reading,
Jannis
PS: The MySQL server itself is running and I am able to login with as root user via the MySQL Administrator.app
Well setting log_errors to on would bring error messages to the web-server's error_log. To do so you can use an .htaccess file placed in your web root with
php_value log_errors = 1
in it. It can be not worked but there is some other ways too. You can edit your php.ini for example and restart your server after it.
Without error message it's hard to guess what is really happened. there can be something wrong with session save path or other settings
This happened to me when I changed my password from within PHPMyAdmin. The solution was simple. Clear the browser cache and try to login again. You should be good to go.
Old thread I know, but I've been struggling all day with this.
I'm on MacOSX Lion. Unfortunately, I've been struggling with the same issue all day. In my case however, I was not getting an errors in the php error_log. So I was clueless as to what was happening. I finally found a setting in phpMyAdmin's config.inc.php and used it like so:
$cfg['Error_Handler']['display'] = true;
After this I was able to see in the browser itself what the problem was with permissions on the folder specified in session.save_path (./tmp which is a symlink to /private/tmp on mac).
However, I'd like to add the setting a 777 to the session.save_path folder may not be the right thing to do. I have done the following which seems safer:
owner: root (default)
group: _www (sudo chgrp _www /private/tmp)
Then allow the group to read, write and execute using:
sudo chmod g+rwx /private/tmp
Prevent others from reading, writing or executing in this folder:
sudo chmod o-rwx /private/tmp
I too upgraded to 10.6, actually I got a new mac and migrated my system over, then I installed phpmyadmin 3.4.2 and was getting messages about not being able to login as well as message about needing mcrypt. I re-installed PHP, now I'm running PHP Version 5.3.6.
I had Navicat on my system and was able to log into mysql database without issue. I tried resetting my mysql password, but that would not take. Not sure why. I had no valuable data so I re-installed MySQL, now I'm running MYSQL 5.5.13.
Still I could not login with phpMyAdmin - however thanks to new MySQL I was no longer seeing message about needing encyption, but I was getting a #1045 error on phpmyadmin. I guess it was telling me I had wrong password. Actually I had never set a password! I guess phpMyAdmin didn't like that as it would not allow me to login without a pw. (as you can see from this post I am not well versed in linux/unix, but I am one persistent fellow! this took me three nights.)
I entered these in Terminal to set a password, then phpmyadmin worked!
1) Need to first stop the MYSQL server, enter this in Terminal, then hit enter:
/etc/rc.d/init.d/mysql stop
2) Then set a password or new password. Needless to say replace 'whatever…" with your password of choice by entering this line in Terminal, and hit enter.
UPDATE mysql.user SET Password=PASSWORD('whateverfornew') WHERE User='root';
3) Now flush the privileges by entering this line in Terminal, and hit enter:
FLUSH PRIVILEGES;
4) Now restart MySQL by entering this line in Terminal, and hit enter:
/etc/rc.d/init.d/mysql start
5) Now login to your phpmyadmin with username "root" and your new password.
Yep, I know this is rudimentary and I have no idea if I am following best practices but for those of us who are new to Mac / Unix and want to get phpmyadmin, mysql etc running this worked for me. Personally I found a lot of forums but most already assume that reader is comfortable using terminal and Unix commands…which I am not - I just wanted a working development zone.

Categories