Home » Open Source » MySQL » Newbie on MySQL, a few questions (MySQL 14.4, Distrib 5.1.73, RHEL5.9)
Newbie on MySQL, a few questions [message #632652] Tue, 03 February 2015 21:02 Go to next message
trantuananh24hg
Messages: 744
Registered: January 2007
Location: Ha Noi, Viet Nam
Senior Member
Good morning, everyone!

As my requirment job feature, I must learn and start to admin the MySQL.
Yesterday, I just finished installation MySQL in RHEL5, associated with mysql_administrator feature. However, as my habit from Oracle operations configuration, I did not want to install MySQL within root account, the root user as my definition is just super-user, controls daemon process, grants any does special something without application. Then, please guide me with a few questions:

1- Can I deploy MySQL in another account differently to root?
2- If yes, may you show me a document or a link to MySQL document? In MySQL administrator document download from Oracle, I did not see something like that. Maybe I were wrong, because this document just only describe of mysql_administrator tool and another relation arround.
3- If I can deploy MySQL Database in another account, must I define:
+ LD_LIBRARY_PATH
+ CLASSPATH
and something else same to Oracle, example: MYSQL_HOME (same to ORACLE_HOME), MYSQL_BASE (same to ORACLE_BASE)?
4- In MySQL Database, if connect to a database, example: JS, I connect in MySql, then, connect to the database with "mysql> connect JS;". How about MYSQL_SID yet?

Thank you!
Re: Newbie on MySQL, a few questions [message #632653 is a reply to message #632652] Tue, 03 February 2015 21:06 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
https://www.google.com/webhp?hl=en&tab=ww#hl=en&q=mysql+install
Re: Newbie on MySQL, a few questions [message #632654 is a reply to message #632653] Tue, 03 February 2015 21:32 Go to previous messageGo to next message
trantuananh24hg
Messages: 744
Registered: January 2007
Location: Ha Noi, Viet Nam
Senior Member
Thank you, BlackSwan,

As my though,
1- the Installation from RPM must be done with root account (the OS user). Then, I did them with root. OK, they were in server, softlink, daemone, service ...
[root@anhtt ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.1.73-community MySQL Community Server (GPL)

Copyright (c) 2000, 2013, 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 |
| anhtt              |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> 


In anhtt mysql database, I have deployed some test table completely.

2- So, I have created an another OS account named as "mysql"
[root@anhtt ~]# id -a mysql
uid=176(mysql) gid=175(mysql) groups=175(mysql)


with profile
# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"; export NLS_DATE_FORMAT
PATH=${PATH}:dd/u01/app/oracle/dba_scripts/bin
JAVA_HOME=/usr/local/java; export JAVA_HOME
MYSQL_TERM=xterm; export MYSQL_TERM
PATH=.:${JAVA_HOME}/bin:$JAVA_HOME/db/bin:${PATH}:$HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=${CLASSPATH}:$JAVA_HOME/db/lib/derby.jar
export CLASSPATH
THREADS_FLAG=native; export THREADS_FLAG
export TEMP=/tmp
export TMPDIR=/tmp
umask 022


It seems ok, then connect to MySQL by mysql OS user
$ mysql -u mysql -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'mysql'@'localhost' (using password: YES)


Try to create user and set password for mysql user:
[root@anhtt ~]# mysqladmin -u mysql password "anhtt";
mysqladmin: Can't turn off logging; error: 'Access denied; you need the SUPER privilege for this operation'


I think I am wrong something, as following google, I read:
Quote:

Please note that MySQL root user account is different from UNIX/Linux root login account. For example, the MySQL root user and the Linux/Unix root user are separate and have nothing to do with each other, even though the username is the same in each case.


Haizz, try again:
$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.1.73-community MySQL Community Server (GPL)

Copyright (c) 2000, 2013, 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> exit
Bye


Can I define the SID same to ORACLE_SID, examply: MYSQL_ID=anhtt, then connect the anhtt MySQL database directly?
Thanks again, BlackSwan!

One more question: If I backup MySQL by another account different to root OS user, can I restore it by the root OS user? Or if I backup by root OS user, can I restore by another account different to root OS user? Does the datafile effectly read/write by privileged?

[Updated on: Tue, 03 February 2015 21:34]

Report message to a moderator

Re: Newbie on MySQL, a few questions [message #632700 is a reply to message #632654] Wed, 04 February 2015 11:58 Go to previous message
Mahesh Rajendran
Messages: 10708
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
MySQL is not Oracle. Period.
ORACLE_SID etc are Oracle specific env variables.
user "root" is very special.
you created mysql OS user and not a database user.
>>MYSQL_ID=anhtt, then connect the anhtt MySQL database directly?
No need.
mysql -u root -pxxx databaseName


But if you are really inclined ( say for scripting purposes)

export mysql_db=yourDb
mysql -u root -pxxx $mysql_db


Previous Topic: News -> OEM support for MySQL now available
Next Topic: Print Cursor output
Goto Forum:
  


Current Time: Sat Nov 23 03:31:42 CST 2024