phpmyadmin - unable to edit config.inc.php - php

While creating a database, I added a root access password, which initially wasn't set.
And now i cant access localhost/phpmyadmin anymore
mysqli_real_connect(): (HY000/1045): Access denied for user
'root'#'localhost' (using password: NO)
I know I have to edit this line in the config.inc.php file
$cfg['Servers'][$i]['password'] = '';
but I cant save the file after making the edit.
If i do it via opening the file normally, I get this:
Failed to save 'config.inc.php': Insufficient permissions. Select
'Retry as Admin' to retry as administrator.
Even after clicking Retry as admin and entering the sudo password, it gives the same error.
If i try via terminal with sudo access and vim edit, I still get unable to open file for writing error.
I am on a mac. I have tried doing this via sudo from terminal, I have tried changing chmod permissions. I have browsed through almost all of the similar questions here, but none of the solution is working.
Nothing seems to work apparently.
Been stuck at this for an hour. Please help!!!

Only solution I was able to find that worked successfully:
From the starting page of Xampp choose open terminal.
In case nano command is not installed, run the following command:
sudo apt-get install nano
Guide to the enclosing folder of confing.inc.php with the help of cd and ls commands. In my case, the file is in
/opt/lampp/phpmyadmin
Run the following command:
sudo nano config.inc.php
Make the necessary changes and save the file.

You need to shuttdown the mysql service (daemon), then edit your config.inc.php and save it. in this step you can run your mysql service.

Related

zsh: permission denied: /Users/..; gem install rails ERROR: While executing gem ... (Errno::EACCES) Permission denied # rb_sysopen - /Users/ [duplicate]

I am trying to install create a new app in Ruby on Rails and I cannot get passed this error:
$ gem install pg
ERROR: While executing gem ... (Errno::EACCES)
Permission denied # rb_sysopen - /Users/stormyramsey/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/pg-0.21.0/.gemtest
Its a permissions issue. You could fix it with this:
sudo chown -R $(whoami) /Library/Ruby/Gems/*
or possibly in your case
sudo chown -R $(whoami) /Users/stormyramsey/.rbenv/versions/2.3.2/lib/ruby/gems/*
What does this do:
This is telling the system to change the files to change the ownership to the current user. Something must have gotten messed up when something got installed. Usually this is because there are multiple accounts or users are using sudo to install when they should not always have to.
It's likely there's a permissions problem somewhere along the .rbenv path. You might try turning on write privileges for your user with:
$ chmod -R +w ~/.rbenv
That will recursively (-R) change the file mode (chmod) to write permission (+w) for all files and directories under your user's .rbenv path. There's no particular reason for not having files set to write.
For Mac M1 systems try,
Allowing full disk access to terminal.
Apple->systemPreferences->Security&Privacy->privacy(Tab)->'+' button, check in Terminal application.
Then Restart terminal
2.Try using,
sudo chflags noschg
Delete the pod folder, reinstall it again. If it doesn't work use this command:
sudo pod install --allow-root
It really doesn't matter on mac how you configure your eyaml create the dir and config manually, add some public key location to it, and its works just fine after adding full disk access to the terminal as Kewin suggested ^ ^. Thumbs up.
No need to change permission, just export GEM_HOME:
export GEM_HOME="$HOME/.gem"
please run:
sudo gem install pg

Unable to Edit config.inc.php

Running: macOS High Sierra Version 10.13.3, zsh w/ iTerm2
Trying to set up a local environment with xampp, which has worked just fine for me in the past. However, I'm now unable to access phpmyadmin after changing the root password via the phpmyadmin UI.
The tutorial I am following (which suggested doing this) pointed me to the config.inc.php file, where the password variable would also need to be updated. Unfortunately, I am unable to edit this file. I've seen other users in Stack Overflow complain of the same issue, but the answer that comes back always seems to involve editing via vi or nano, which doesn't work for me either. Here's an example of what happens when using nano.
I open file via nano
sudo nano config.inc.php
My terminal then prompts me for the system password.
Once in nano, I navigate to the password variable and enter it:
$cfg['Servers'][$i]['password'] = '[mypassword]';
I then attempt to save using ctrl+O, where I'm prompted:
File Name to Write: config.inc.php
and then after hitting ENTER receive the error from nano:
Error writing config.inc.php: Permission denied
I've also tried to editing the file via Sublime Text 3, where my machine prompts me to enter the user password. I receive no error message after doing that, but still cannot access phpmyadmin. I am unable to use chmod to edit permissions on the file, and restarting the mysql server after editing the config.inc.php file also does not work.
Why is nano throwing the "permission denied" error even after I've entered my system password?
Thanks!
I was able to resolve this by accessing the config.inc.php file via the terminal provided by xampp.
First things first, the xampp-provided terminal needed nano (to edit the file) installed.
apt-get update
apt-get install nano
I then navigated to the file:
cd ../opt/lampp/phpmyadmin
Then opened the file with nano:
nano config.inc.php
or try
sudo nano config.inc.php
This finally allowed me to edit the config.inc.php file and successfully save.
Great question. I had to work on this for an hour to figure it out too.
Open Xaamp and go to "Open Terminal" on the main page. Make sure the server is running.
You can run "apt-get update" like the other person said above me. The main one you want is "apt-get install nano"
Then do "cd .." so you can back out of the file. The other person said "cd ../opt/... " but that command didn't work for me. What worked was doing "cd .."
Then do cd again, type in "cd opt/lampp/phpmyadmin"
Then type "nano config.inc.php"
You should now be able to edit it. Hit control + o to save it.
It worked for me. It took me an hour to figure it out.
As I thought, I have the same issue as the above, I tried all the commands and I have changed the config.inc file into these settings :
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = '';
But I still end by the same error when I'm acceding to phpmyadmin
Any solutions please ??
Try this to edit the file:
Open terminal from Xampp -> enter apt-get update then -> enterapt-get install nano then -> navigated to the file cd ../opt/lampp/phpmyadmin -> open the file nano config.inc.php make changes as you like -> to save, press control + O and control + M and to exit -> control + X
You might not need to edit the file to solve the error. just try this:
Open terminal from Xampp -> enter apt-get update then -> enterapt-get install nano then -> navigated to mysql folder cd ../opt/lampp/var/mysql -> delete these files rm ib_logfile0 enter and -> rm ib_logfile1 enter
now restart Xampp.

Laravel migrations work fine, but when I open a page I get "SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'x.x.x.x' (13)" - using vagrant

I have set up multiple vagrant boxes, where I separated the database in an independent box and the app into its own box.
Worth noting that I am not using laravel homestead. Both servers running CentOS 7.
I can connect from HeidiSQL on my windows machine, I can even run php artisan migrate --seed via ssh and it migrates the tables perfectly fine. However when I open pages that are dependent on database connections, I get SQLSTATE[HY000] [2003] Can't connect to MySQL server on '192.168.3.16' (13).
It is also worth mentioning that I am having file permission problems and laravel is not able to cache the views as I am getting the following: file_put_contents(/var/www/html/autofollow/storage/framework/sessions/N3Z5v2PxiKdgbCwOxXZylmnLZYbgCE4UEOM7uluq): failed to open stream: Permission denied
As weird as it sounds, it might have to do something with permissions. I tried everything regarding file permissions, setting the owner and group to apache with chown -R vagrant:apache, and even changing all permissions to 777 for testing purposes, but nothing works.
At this point I am having a big headache, and really hope someone with the same experience will be able to help me out.
Thanks in advance!
EDIT: This is an example where it gets triggered
/**
* #return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function index()
{
$plans = Plan::all();
return view("frontend.pricing", compact("plans"));
}
Try running this at the app root
sudo chgrp -R vagrant storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
Your permission problem doesn't allow Laravel to create the session file
Fixed both problems by disabling SELinux:
sudo vim /etc/sysconfig/selinux
and change it to disabled:
SELINUX=disabled
To check the status:
sestatus

initialize Permission denied # rb_sysopen - Vagrant Up

I Install Vagrant in my Ubuntu(14.4) System. When i Enter Vagrant Up comment Display following Errors.
/opt/vagrant/embedded/gems/gems/vagrant-1.8.5/lib/vagrant/machine_index.rb:321:in `initialize': Permission denied # rb_sysopen - /home/w3cert/.vagrant.d/data/machine-index/index.lock (Errno::EACCES)
Permission denied
means that the file /home/w3cert/.vagrant.d/data/machine-index/index.lock is owned by another user and your current user has no permission.
check who is the owner of your file, if you run any install/command with sudo or root then your current user will not have access to modify the file.
for now you can change the ownership of all .vagrant.d files to your account and you should be able to run the vagrant up command
i had the same problem. I used Vagrant before and uninstall it. When i tried to reinstall back i had the same error
My solution was to delete the .vagrant.d temp folder (in your case /home/w3cert/.vagrant.d/)
Hope it works for you as well
As Manuel stated, deleting the .vagrant.d folder will solve the issue.
oddly this happened on windows as well, i didn't install anything new, or reinstall vagrant or anything like that. the only thing i can think of is the power cut we had last week has caused a folder/file lock... although a reboot should solve that :S

.composer/config file permission denied using laravel

I have a laravel project on an ubuntu virtualbox.
I used to run composer update and all worked fine. I don't know of any changes that could have affected this but now when I run composer update I get
file_get_contents(/home/user/.composer/config.json): failed to open stream:
Permission denied
Does anyone know why? When I run sudo composer update , it works.
Your permissions got changed somehow (perhaps not related with running composer). Setting the owner of that file as your user should fix the issue:
sudo chown user /home/user/.composer/config.json
The above assumes that the username is user from the home path. As a side note, it works when running it as a super user using sudo because there's no permissions restrictions in that case.
It seems you don't have valid permissions for this file. Try running:
sudo chmod 0777 /home/user/.composer/config.json
EDIT
Of course, you should do it only in development environment (you mentioned you use Virtualbox). You should not do it in production environment.
Run below command.
sudo composer update

Categories