mysql 5.5 安裝

==============安裝mysql======================

yum install  libaio-devel ncurses -y 

===========================================

mkdir /opt/tools -p

cd /opt/tools

groupadd mysql

useradd -s /sbin/nologin -M mysql -g mysql

tar xf mysql-5.5.32-linux2.6-x86_64.tar.gz

mv mysql-5.5.32-linux2.6-x86_64  /opt/mysql-5.5.32

ln -s /opt/mysql-5.5.32/ /opt/mysql

chown -R mysql.mysql /opt/mysql/

cd /opt/mysql

/opt/mysql/scripts/mysql_install_db --basedir=/opt/mysql/ --datadir=/opt/mysql/data/ --user=mysql

/bin/cp /opt/mysql/support-files/my-small.cnf /etc/my.cnf

sed -i 's#/usr/local/mysql#/opt/mysql#g' /opt/mysql/bin/mysqld_safe

/opt/mysql/bin/mysqld_safe &

echo "PATH="/opt/mysql/bin:$PATH"" >>/etc/profile

source /etc/profile

cp support-files/mysql.server /etc/init.d/mysqld

sed -i 's#/usr/local/mysql#/opt/mysql#g' /etc/init.d/mysqld

chmod +x /etc/init.d/mysqld

killall mysqld

/etc/init.d/mysqld start

netstat -lntup |grep mysql

chkconfig --add mysqld

chkconfig mysqld on

chkconfig --list mysqld

echo "/etc/init.d/mysqld start" >>/etc/rc.local

安裝完畢

======================================================

#mysql

show databases;

select user();

exit

# mysqladmin -u root password '密碼'

# mysql -uroot -p

select user,host from mysql.user;

設置root密碼完畢


==========================================================

grant all PRIVILEGES on *.* to 用戶@'%'  identified by '密碼'; 

#授權用戶(test)對所有庫所有的權限

flush privileges;


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章