添加服务 让mysqld开机自动启动
- echo 复制下面整段shell到命令行终端中,会自动逐条执行。
- sudo apt-get install -y libaio1
- sudo apt-get remove -y mysql-common mysql-server mysql-client
- sudo rm -rf /etc/mysql/
- wget -O mysql-5.5.20-linux2.6-x86_64.tar.gz http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.20-linux2.6-x86_64.tar.gz/from/http://mysql.oss.eznetsols.org/
- tar -zxvf mysql-5.5.20-linux2.6-x86_64.tar.gz
- sudo mv ./mysql-5.5.20-linux2.6-x86_64 /usr/local/mysql
- sudo groupadd mysql
- sudo useradd -r -g mysql mysql
- cd /usr/local/mysql
- sudo chown -R mysql .
- sudo chgrp -R mysql .
- sudo /usr/local/mysql/scripts/mysql_install_db --user=mysql
- sudo chown -R root .
- sudo chown -R mysql data
- sudo cp support-files/my-medium.cnf /etc/my.cnf
- sudo ln -s /usr/local/mysql/bin/mysql /usr/bin/
- sudo ln -s /usr/local/mysql/bin/mysqldump /usr/bin/
- sudo cp support-files/mysql.server /etc/init.d/mysql
- sudo /etc/init.d/mysql start
- ./bin/mysqladmin -u root password '1'
- sudo /etc/init.d/mysql restart
- mysql -uroot -p1
安装完成,需要配置mysql。请看:mysql常用设置:字符集编码、自动完成(自动提示)、监听外网ip
- sudo cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
- sudo update-rc.d mysql defaults
新闻热点
疑难解答