标签:
1. 安装cmake: sudo apt-get install cmake
2.安装MySQL5.5
a) 下载:sudo wget http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.40.tar.gz
b) 解压并进入目录: sudo tar zxvf mysql-5.5.40.tar.gz && cd mysql-5.5.40
c) 编译安装:
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql/ -DMYSQL_DATADIR=/root/mysql/data/ -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_TCP_PORT=3306 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DMYSQL_USER=mysql -DWITH_DEBUG=0
d)make
e)make install
f) 配置
sudo cp support-files/my-medium.cnf /etc/my.cnf
sudo cp support-files/mysql.server /etc/init.d/mysqld
sudo chmod 755 /etc/init.d/mysqld
e) 初始化MySQL
三、 启动和停止MySQL
sudo /etc/init.d/mysqld start
sudo /etc/init.d/mysqld stop
【 MySQL: Starting MySQL….. ERROR! The server quit without updating PID file解决方法】
cd /usr/local/mysql/
chown -R mysql:mysql .
[root@localhost mysql]# su - mysql
[mysql@localhost ~]$ cd /usr/local/mysql
[mysql@localhost mysql]$ scripts/mysql_install_db
/usr/local/mysql/bin/mysqld_safe --user=mysql &
b) 安装连接MySQL客户端
sudo apt-get install mysql-client
c) 连接MySQL测试
mysql –u root
-------------------------------------------
The program ‘mysql‘ can be found in the following packages:
* mysql-server-core-5.1
* mysql-cluster-server-5.1
* mysql-server-core-5.0
Try: apt-get install <selected package>
并不是真的错误而不错
是因为编译安装mysql的
mysql/bin目录没有添加到path里面
所以要cd 到mysql/bin目录下然后 ./mysql 或者 .bin/mysql -uroot -p
【注:直接进入目录cd /usr/local/ 然后 sudo ./mysql -uroot -p】
标签:
原文地址:http://www.cnblogs.com/bluewelkin/p/4233459.html