安裝mysql筆記mysql
下載:cmake-2.8.7.tar.gzc++
下載:bison-2.5.tar.gzsql
下載:mysql-5.5.23.tar.gzvim
yum groupinstall 'Development Tools' yum install ncurses-devel yum install gcc yum install gcc-c++ tar zxvf cmake-2.8.7.tar.gz cd cmake-2.8.7 ./configure --prefix=/usr/local/cmake gmake & gmake install vim /etc/profile export PATH=/usr/local/cmake/bin:$PATH reboot tar zxvf bison-2.5.tar.gz cd bison-2.5 ./configure make & make install /usr/sbin/groupadd mysql /usr/sbin/useradd -g mysql mysql tar xvf mysql-5.5.23.tar.gz cd mysql-5.5.23/ cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_UNIX_ADDR=/tmp/mysql.sock \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DENABLED_LOCAL_INFILE=1 \ -DMYSQL_DATADIR=/data/mysql/data make make install chmod +w /usr/local/mysql chown -R mysql:mysql /usr/local/mysql ln -s /usr/local/mysql/lib/libmysqlclient.so.16 /usr/lib/libmysqlclient.so.16 mkdir -p /data/mysql/ mkdir -p /data/mysql/data/ mkdir -p /data/mysql/log/ chown -R mysql:mysql /data/mysql/ cd support-files/ cp my-large.cnf /data/mysql/my.cnf cp mysql.server /etc/init.d/mysqld /usr/local/mysql/scripts/mysql_install_db \ --defaults-file=/data/mysql/my.cnf \ --basedir=/usr/local/mysql \ --datadir=/data/mysql/data \ --user=mysql chmod +x /etc/init.d/mysqld vim /etc/init.d/mysqld 修改如下內容 basedir=/usr/local/mysql datadir=/data/mysql/data chkconfig --add mysqld chkconfig --level 345 mysqld on service mysqld start
修改root密碼bash
/usr/local/mysql/bin/mysql -u roottcp
use mysql;ide
UPDATE user SET Password = PASSWORD('a654ac7ab') WHERE user = 'root';server
FLUSH PRIVILEGES;ip
遠程訪問ci
/usr/local/mysql/bin/mysql -u root
grant all privileges on *.* to 'root'@'%' identified by 'a654ac7ab' with grant option;
flush privileges;
容許3306端口
vim /etc/sysconfig/iptables
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT