Writing by shivdev on Friday, 27 of May , 2016 at 7:35 am
Painful process, but you will need to see what works for you.
Say you’ve done the following:
- Downloaded the DMG and installed MySQL on your Mac (and it provided you a password)
- Started it from System Preferences -> MySQL
- Now you tried different ways to connect to MySQL but are not able to login to localhost
- So, then you tried brew and it didn’t work. Go ahead and remove mysql from brew
- sudo brew remove mysql
- brew cleanup
Now, here’s what worked for me, thanks to the following:
- https://www.variphy.com/support/knowledge-base/mac-os-x-reset-mysql-root-password
- http://stackoverflow.com/questions/30692812/mysql-user-db-does-not-have-password-columns-installing-mysql-on-osx
# Start MySQL in Safe Mode
$ sudo /usr/local/mysql/bin/mysqld_safe –skip-grant-tables
# Connect to MySQL as root (without password)
$ sudo /usr/local/mysql/bin/mysql -u root
# Update the password
mysql>use mysql;
mysql>show tables;
mysql> update user set authentication_string=password(‘new_password’) where user=’root’;
# Kill the mysql safe process and start it from System Preferences -> MySQL
alias mysql=’/usr/local/mysql/bin/mysql -uroot -ppassword’
That worked for me and I was able to kill the mysql safe-mode process and connect to MySQL through CLI as well as a GUI like Sequel Pro.
Optionally, to add python drivers that will fail further if the following is not done.
# add this to your $PATH
export PATH=$PATH:/usr/local/mysql/bin
# pip install in the right venv
pip install MySQL-python
Category: Mac,SQL DB
Writing by shivdev on Sunday, 15 of May , 2016 at 4:04 am
Although SSH is available on the Mac, you need to enable Remote Login. Otherwise you will see
$ ssh localhost
ssh: connect to host localhost port 22: Connection refused
Good article from StackOverflow describes this
System Preferences -> (under) Internet & Networking -> Sharing -> check Remote Login and select the users
Category: Mac
Writing by shivdev on Tuesday, 22 of September , 2015 at 5:34 am
If FileVault encryption is on and you’re not able to see other user accounts to login with:
System Preferences -> Privacy & Security -> FileVault -> Enable users…
Select the account and provide the user’s password.
Restart and you should see that user to login with
More info on apple.stackexchange.com.
Category: Mac
Writing by shivdev on Tuesday, 26 of May , 2015 at 5:25 am
While using sed in-place edit through sed -i on MacOS X, you will run into the following error.
This will ERROR out
mac:tmp shivdev$ sed -i “s/Apr/May/g” x.log
sed: 1: “x.log”: extra characters at the end of x command
Using an empty extension as shown below Will PASS
mac:tmp shivdev$ sed -i “” “s/Apr/May/g” x.log
The reason that it works fine on Ubuntu but not on MacOS is that it uses a BSD sed (not GNU sed like Ubuntu)
-i extension
Edit files in-place, saving backups with the specified extension.
If a zero-length extension is given, no backup will be saved. It
is not recommended to give a zero-length extension when in-place
editing files, as you risk corruption or partial content in situ-
ations where disk space is exhausted, etc.
Category: Linux,Mac
Writing by shivdev on Tuesday, 14 of April , 2015 at 6:32 am
I’m so used to iTerm now and really need word navigation. (I do miss Windows some of the time)
Well Meta Key to the rescue. Great article by Serge Émond. But, in a nutshell…
Esc + f (Move forward one word)
Esc + b (Move back one word)
Esc + d (Delete word to the right)
Esc + delete (Delete word to the left)
Category: Mac
Writing by shivdev on Friday, 13 of March , 2015 at 7:48 pm
Pretty straightforward. If you don’t have a samba share here’s How to Create a Network Share Via Samba Via CLI (Command-line interface/Linux Terminal). So now you have a Samba Share on Linux.
Here’s a snippet of my /etc/samba/smb.conf that contains the Linux folder on my VM that I would like to access from the Mac. (In your Mac: it will show up under /Volumes/vm_codebase).
Of course you can ssh into your Linux env, but this is more like mounting onto your Mac.
[vm_codebase]
path = /home/shivdev/codebase
available = yes
valid users = shivdev
read only = no
browseable = yes
public = yes
writable = yes
From your Mac. Open Finder : Go –> Connect to Server… –> smb://vm –> Chose vm_codebase
Now you will see it under /Volumes/vm_codebase and is accessible like a regular folder.
Category: Linux,Mac