bugcy013
9/8/2014 - 5:06 AM

Install MySQL Non-root user

Install MySQL Non-root user

Step1:  Download MySQL Community Server x.x.x TAR Archive and untar it in user home folder

Step2: Create a my.cnf file in user home directroy

[server]
user=username
basedir=/home/username/mysql
datadir=/home/username/sql_data
socket=/home/username/socket
port=3666

Step3: Create directory with the below command

./scripts/mysql_install_db --defaults-file=~/my.cnf --user=username --basedir=/home/username/mysql --datadir=/home/username/sql_data --socket=/home/username/socket

Step4: Changing the path in mysqld_safe file

Step5: Starting the mysql server.
./bin/mysqld_safe --defaults-file=~/my.cnf &

Step6: Setting password for root user
mysql --socket=/home/testmysql/socket -u root
UPDATE mysql.user SET Password=PASSWORD('hereweg0') WHERE User='root';mysql --socket=/home/testmysql/socket -u root -p


Error message in starting mysql:
mysqld.log'.
cat: /var/lib/mysql/dhana55.pid: Permission denied
rm: cannot remove `/var/lib/mysql/dhana55.pid': Permission denied
130823 15:07:32 mysqld_safe Fatal error: Can't remove the pid file:
/var/lib/mysql/dhana55.pid
Please remove it manually and start mysql/bin/mysqld_safe again;
mysqld daemon not started
mysql/bin/mysqld_safe: line 128: /var/log/mysqld.log: Permission denied


@Note: the above path is not the correct path. Please use the config and script within the user home directory.

[testmysql@dhana55 bin]$ 130826 07:01:38 mysqld_safe Logging to '/home/testmysql/sql_data/dhana55.err'.
130826 07:01:38 mysqld_safe Starting mysqld daemon with databases from /home/testmysql/sql_data


[testmysql@dhana55 bin]$ mysql --socket=/home/testmysql/socket -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.33 MySQL Community Server (GPL)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| ABC                |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.02 sec)

mysql>