Showing posts with label Terminal. Show all posts
Showing posts with label Terminal. Show all posts

Monday, August 22, 2011

Installing the MySQL database on Mac OS X

At first we need to download the MySQL Server with the official site. Note that the download version is needed for your hardware platform, for us it's Mac OS X.

After downloading in the Downloads folder will appear file mysql-5.1.37-osx10.5-x86.dmg, which must be assembled by double-clicking. In the window that in turn run the two packages:
  1. mysql-5.1.37-osx10-x86.pkg - in fact the server itself;
  2. MySQLStartupltem.pkg - set to automatically run the server.
After installation, go to the most important step, to create the database and set up an account administrator.

The first step is run in a terminal server installed:

sudo /Library/StartupItems/MySQLCOM/MySQLCOM start

If the error message does not appear, and the output of sudo ps ax | grep mysql shows the existence of a process that's all right, go next.

Next you need to create aliases for the management console mysql server and administration tools for server mysqladmin, all this in order to enter at startup not the full path to the files:

alias mysql=/usr/local/mysql/bin/mysql
alias mysqladmin=/usr/local/mysql/bin/mysqladmin

Now, most importantly, set an administrator password MySQL-server:

mysqladmin -u root password 'new admin password'

By default the administrator password blank, which is not good, therefore it is better to change, or rather to ask. That's all, the server is up and ready to go.Let us verify this by typing in a terminal mysql-u root-p, then the password prompt to enter an administrator password specified earlier.

On the screen we see the following:
Own MySQL-server on OS X is installed and ready to go.

Reset MySQL root password

Forgot root-password database to MySQL? It does not matter. It can be easily restored.

Stop the service:

# /etc/init.d/mysql stop

and restart it manually with ignoring privileges:

# mysqld_safe –skip-grant-tables &

Now we can create a new password:

# mysql -u root 
   
mysql> use mysql; 
mysql> update user set password=PASSWORD(”new_password”) where User=’root’; 
mysql> flush privileges;
mysql> quit

And restart MySQL in normal mode:

# /etc/init.d/mysql restart

This is that what I did in my Mac OS.

in terminal:
cd /usr/local/mysql/bin/mysql

mysql> use mysql; 
mysql> update user set password=PASSWORD(”new_password”) where User=’root’; 

the end  

Sunday, August 21, 2011

How do reset the administrator password in Mac OS X without installation disk?

Let's say you forgot your password on the Mac. Or have just purchased a Macintosh from hands, and the former owner has locked the computer. There are several elegant solutions to this problem without the installation DVD-ROM with Mac OS X. 
Perhaps this topic has been bored, but it affects the important question that people ask constantly. I do not want to think that any user, once next to your computer can theoretically obtain access to it for several minutes. And before you decide that the Mac OS X has a serious vulnerability, I hasten to you "good news": any operating system, whether Windows, Linux or Mac can be hacked for a couple of minutes, if you know what to do. A hacker sitting at your computer, can circumvent any security measures.

Reset the password in Mac OS X 10.6 Snow Leopard
  1. Turn on or restart your Mac.
  2. At the time greeting (or gray screen), hold down the keyboard Command + S to boot into single user mode. 
  3. Step is optional, but it is useful to go through, because this way you check for errors on your hard drive. In the prompt, type fsck-fy and press Enter. Wait until the end of the disk check.
  4. Write mount-uw / and press Enter.
  5. Next launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist and press Enter.
  6. Type ls /Users and press Enter. The command will list all users on a computer - useful if you do not know or do not remember.
  7. In line dscl . -passwd /Users/username password Replace "username" with your user name (see above), and instead of "password" enter the code combination of characters and press Enter.
  8. To reboot execute the command reboot.
Reset Password on Mac OS X 10.4 Tiger
  1. Turn on or restart your Mac.
  2. At the time greeting (or gray screen when you turned it off), hold down the keyboard Command + S to boot into single user mode.
  3. Write to the line sh /etc/rc and press Enter.
  4. Type passwd username and replace "username" for a short user name of the account, which are going to reset your password.
  5. Enter the desired password and press Enter.
  6. To reboot execute the command reboot.
Cheating and creating a new Mac user
  1. Turn on or restart your Mac.
  2. At the time greeting (or gray screen when you turned it off), hold down the keyboard Command + S to boot into single user mode.
  3. Step is optional, but it is useful to go through, because this way you check for errors on your hard drive. In the prompt, type fsck-fy and press Enter. Waituntil the end of the disk check.
  4. Write mount-uw / and press Enter.
  5. Then rm /var/db/.AppleSetupDone and press Enter.
  6. Now shutdown-h now and press Enter.
The third method requires some explanation.
Instead replace the password in the first two methods, it is in its own way, cheating of the operating system. The trick makes the system think that it still did not run. This means that when you restart the Mac, you have to re-take all the steps in setting and registration. Do not worry, all information on mac in safe and sound. Walk through the steps, but in the end give up the migration of data on your Mac.

Then log on Mac under a new administrator account and go to Settings Panel -> User Accounts. Perhaps, before making any changes need to unlock the padlock in the bottom left corner. In the left column you should see the original(s) account. Click on the desired unchecked and turn it into a standard account (uncheck the "Enable. This user to administer computer") and change your password. Now you can go to the computer under that account and get access to all your files and programs. You can go back under the Administrator account and check checkbox "Allow. this user to administer computer "in System Preferences to give administrative rights to the user.

As always, remember that a combination of single-user mode (single-user mode or superuser) and the terminal is extremely dangerous and can lead to big problems in the event of your mistakes.

If you have a password in the Keychain (Keychain Access), is likely to be reset as well. Do this by choosing the "input" under a bunch of keys on the left and click Delete from the Edit menu. You will lose all the keys and add them again.