MySQL Database INSTALLATION and UN-INSTALLATION Commands for LINUX


MySQL INSTALLATION FOR LINUX
……………………………………………………

[root@server root]# cd /root

[root@server root]# mkdir /root/files /data /data/mysql

[root@server root]# cd files


4.0.12.tar.gz

[root@server root]# tar xzvf mysql-4.0.12.tar.gz

[root@server root]# cd mysql-4.0.12
if your using FreeBSD use "adduser" instead of "useradd". [root@server root]# groupadd mysql
[root@server root]# useradd -g mysql mysql

[root@server root]# ./configure --prefix=/usr/local/mysql

--datadir=/data/mysql



DataDir is where your mysql databases will be stored including the database which contains all mysql user accounts,
you can easily backup all databases/users by saving the contents of this folder. /data/mysql
NOTE: If you see ERROR: No curses/termcap library found" find where libncurses.so.5 is installed on your system and add the following flag to your configure statement : --with-named-curses-libs=/usr/lib/libncurses.so.5 (or
where ever it may be)



if you get a "mod_auth_dbm" Error

Copy the ndbm.h file from /usr/include to the /usr/include/db1 directory (or install db1-devel)


if you get a "no acceptable C compiler found in $PATH" Error

Install a c compiler, example: gcc



if you get "libmysql.c:1349: warning: passing arg 5 of `gethostbyname_r' from incompatible pointer type" Error
you need to install a c++ compiler, install: libstdc++-devel, gcc-c++ (same version as gcc)


[root@server root]# make

[root@server root]# make install

[root@server root]# ./scripts/mysql_install_db

[root@server root]# ln -s /usr/local/mysql/share/mysql/mysql.server

/sbin/mysqld



[root@server root]# chown -R mysql:mysql /data/mysql

[root@server root]# chown -R mysql:mysql /usr/local/mysql



Start, Stop & Restart MySQL

---------------------------------------- [root@serverroot]# mysqld start [root@server root]# mysqld stop
[root@server root]# mysqld restart



Using MySQL

----------------------------------------

Export Database:

[root@server root]# /usr/local/mysql/bin/mysqldump -u root -p database_name > database_name.sql


Import Database:

[root@server root]# /usr/local/mysql/bin/mysql -u root -p database_name <

database_name.sql



Set root password:

[root@server root]# /usr/local/mysql/bin/mysqladmin -u root -p password

NEW_PASS


NOTE: When it prompts you to enter the password, just hit Enter if you don't see an error, the password was successfully changed.




Uninstalling MySQL

---------------------------------------- 
[root@server root]# rm -rf /usr/local/mysql [root@server root]# rm -rf /data/mysql
[root@server root]# rm -rf /sbin/mysqld

mysql installation, mysql uninstallation | mysql tutorial, commands, php, queries | mysql download | mysql install |  mysql installation on linux, windows, queries, commands | mysql database installation guide from source | tutorials | configuration | mysql database tutorials |

0 comments:

Post a Comment