After using sudo stll Permission denied - mysql

I run Mac OS 10.9.5 and I am wanting to change my mySQLWorkbench root password and followed these instructions with this command (obviously inputing the correct directory and all)
sudo kill cat /mysql-data-directory/host_name.pid
I get this error
cat: /usr/local/mysql/data/rodongi.pid: Permission denied
Password:
usage: kill [-s signal_name] pid ...
kill -l [exit_status]
kill -signal_name pid ...
kill -signal_number pid ...
Although I am on an admin account on my Mac ( the usage: part comes after putting the password )
I tried using with sudo !! but it still doesn't work.

Copied from: Terminal doesnt not recognise mysqld and mysql commands
The cat command surrounded by backticks is executed by the shell before running the sudo command (If the file was readable for everyone the shell will execute something like: sudo kill 12345).
To run the cat as root you should run this command:
sudo bash -c 'kill cat /usr/local/mysql/data/rodongi.pid'
That way, you run bash as root, which in turn runs the kill command, and thus reads the rodongi.pid file as root.

Related

couchbase-cli: command not found

I downloaded deb package from https://www.couchbase.com/downloads and installed it using:
sudo dpkg -i couchbaseXXX.deb
It is successfully installed but when I try to execute:
couchbase-cli bucket-create -c localhost:8091 -u Administrator ****
Returns:
couchbase-cli: command not found
What is the issue behind that, How to fix it?
First you have to setup the couchbase cluster with same command before the bucket creation. An example below, --services could be index,data,query.
/opt/couchbase/bin/couchbase-cli cluster-init -c 127.0.0.1:8091 -u Administrator -p Public123 --cluster-username=Administrator --cluster-password=Public123 --cluster-port=8091 --cluster-ramsize=49971 --cluster-index-ramsize=2000 --services=data
you have to go into CLI directory location and run the command.
Below are the steps I have done.
cd /opt/couchbase/bin
./couchbase-cli bucket-create -c localhost:8091 -u Administrator -p password --bucket test-data --bucket-type couchbase --bucket-ramsize 100
Once I run the above command, I got the success message and the bucket has been created.

"ERROR! MySQL server PID file could not be found!", yet a mysqld process is running on port 3306?

I notice that a mysqld process is running on port 3306:
$ sudo lsof -i :3306
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 63026 _mysql 19u IPv6 0x67fbb37dac8af9c7 0t0 TCP *:mysql (LISTEN)
I would like to stop this process. However, if I try mysql.server stop, I get the following error:
$ mysql.server stop
ERROR! MySQL server PID file could not be found!
I'm on MacOS, by the way. Using sudo, I'm able to find a .pid file:
$ pwd
/usr/local/mysql
$ sudo find . -name '*pid'
./data/mysqld.local.pid
However, I'm not sure whether it's the one expected by the mysql.server stop command.
The problem I'm ultimately trying to solve is that when I try the mysql command, I get the following error:
$ mysql
ERROR 1045 (28000): Access denied for user 'kurtpeek'#'localhost' (using password: NO)
I'm trying to follow the password reset instructions at https://dev.mysql.com/doc/refman/8.0/en/resetting-permissions.html, but I can't seem to get past the first step, which is to stop the MySQL server. Any help would be much appreciated.
I found a high-level explanation of this problem at https://apple.stackexchange.com/questions/255671/error-mysql-server-pid-file-could-not-be-found. The server has to be stopped using the MySQL Preferences Pane:
Now the sudo lsof -i :3306 command doesn't show any processes running.

Terminal doesnt not recognise mysqld and mysql commands

I am runnin OSX 10.9.5 and while trying to reset my MySQL root pasword I typed this:
sudo mysqld_safe --skip-grant-tables
After being asked for the admin password, I got this error :
sudo: mysqld_safe: command not found
I wrote this in
cd /usr/local/mysql
Also, I have a problem with the sudo command, event though I am logged on the admin account my account, It gives me often permission denied, like using this command for basically the same problem ( reseting my root password )
sudo kill cat /usr/local/mysql/data/rodongi.pid
I then got
cat: /usr/local/mysql/data/rodongi.pid: Permission denied
Password:
After entering the password …
usage: kill [-s signal_name] pid ...
kill -l [exit_status]
kill -signal_name pid ...
kill -signal_number pid ...
I have no idea why
1) I dont have the permission even though I used the sudo command( and another time sudo!! )
2) Why msql-bash doesn't not recognise the mysql and mysqld command ( I also tried in terminal-bash;does not work either)
First problem
You're trying to execute the command mysqld_safe, so that command should be on the PATH where the terminal looks for commands. (You can view these locations by running echo $PATH. The different locations are separated with a colon).
Since you're trying to run a file that is in the local directory you should type ./mysqld_safe to tell the shell that you're giving a path to file, otherwise it'll search for it in the PATH. (You can run the file from anywhere by specifying the full path).
Another solution is to make a symbolic link in /usr/local/bin/ that points to /usr/local/mysql/mysqld_safe` (which is the path to the command if I understood you correctly). That way you can run the command from anywhere because it's in the path the shell is looking for.
Second Problem
The cat command surrounded by backticks is executed by the shell before running the sudo command (If the file was readable for everyone the shell will execute something like: sudo kill 12345).
To run the cat as root you should run this command:
sudo bash -c 'kill `cat /usr/local/mysql/data/rodongi.pid`'
That way, you run bash as root, which in turn runs the kill command, and thus reads the rodongi.pid file as root.

Permission denied while creating a symbolic link

I am installing mysql using homebrew for Mac OS X. Once the installation completes these options are given in the terminal:
To connect:
mysql -uroot
To have launchd start mysql at login:
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
Then to load mysql now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Or, if you don't want/need launchctl, you can just run:
mysql.server start
So what I would like to do is have mysql started at login but when I enter the command I get permission denied like so:
$ ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
ln: /Users/xxxxxxxxxxxxxx/Library/LaunchAgents/homebrew.mxcl.mysql.plist: Permission denied
Any suggestions as to why this may be occuring?
Did you try sudo?
$ sudo ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
^^^^
I have similar issue while trying to run ln -s /Applications/ngrok ngrok. It returns permission denied. That means you need to allow Administrator to delegate a user to perform the operation. By prepending sudo will give that privilege and the system will prompt you for administrator password. sudo ln -s /Applications/ngrok ngrok
For more information on sudo.
This happened to me on a web server where I have limited access (no sudo), so what worked for me was putting the symbolic link under /home//bin instead. I was able to install custom apps that I needed and setup them to work globally in this way. Hope this might help someone.

Something goes wrong with the SSH while setting up hadoop

I'm a new fish for hadoop.I installed Ubuntu 12.10 on my computer and I wanna install Hadoop in pseudo-distributed mode on one single node.I searched and get lots of tutorials but I have a problem with the SSH.I did what the tutorial said.
I am sure the problem is about the SSH.I get the openssh-server,and had done this:
hadoop00#WebsoftStation:~$ssh-keygen -t dsa -P "" -f ~/.ssh/id_dsa
hadoop00#WebsoftStation:~/.ssh$cat ~/.ssh/id_dsa.pub >> authorized_keys
Then I can successfully ssh my localhost like this:
hadoop00#WebsoftStation:~$ssh localhost
It worked.
So I changed the path to hadoop and then:
hadoop00#WebsoftStation:/usr/local/hadoop$ sudo bin/start-all.sh
[sudo] password for hadoop00:
starting namenode, logging to /usr/local/hadoop/libexec/../logs/hadoop-root-namenode-WebsoftStation.out
root#localhost's password:
root#localhost's password: localhost: Permission denied, please try again.
So,what's the problem?
You have setup password-less ssh for only your current account. Since, when you can use ssh localhost without any problem, the thing you need to do next is giving execution permission to your scripts.
Execute the following commands:
chmod +x bin/*.sh ---> assigns execution permission to all the scripts
./start.all ----> executes the script
Note: Hadoop can also be run without having password-less ssh setup using hadoop-daemon.sh script. The only advantage with password-less ssh is that, the ./start.all, script will take the trouble of doing that on behalf of you in each of the nodes.
You need to change permissions for your Hadoop folder to be owned by the hadoop00 user:
cd /usr/local/
sudo chown -R hadoop00:hadoop00 /usr/local/hadoop
Then you can cd into the sbin folder and run things without sudo. If you use sudo you're running the scripts as root which has different environment variables etc which is why you have a different behavior.
Why are you using sudo this is clearly a permission problem.
Try running this without sudo
bin/start-all.sh