简体   繁体   English

在Ubuntu 11.10中安装MySQL 5.5

[英]Install MySQL 5.5 in Ubuntu 11.10

I have been downloaded the DEB package of mysql 5.5.23. 我已经下载了MySQL 5.5.23的DEB包。
Install MySQL by the command as follows: 通过以下命令安装MySQL:

sudo dpkg -i mysql-5.5.23-debian6.0-x86_64.deb

The result said that installed successfully. 结果说安装成功。
But when I type the command: 但是当我键入命令时:

sudo service mysql start

Or 要么

mysql

It shows me that "mysql: unrecognized service" or "mysql: command not found". 它向我显示“ mysql:无法识别的服务”或“ mysql:未找到命令”。
Besides, I can't find MySQL files in "/usr/include" or "/usr/bin" 此外,我在“ / usr / include”或“ / usr / bin”中找不到MySQL文件

Please help me. 请帮我。 Thx. 谢谢。

由于未打包MySQL 5.5.x,因此存储库中仅存在5.1.x。这对我有用: http : //www.rebojo.com/debian-installing-mysql/

Why not a simple command : 为什么不使用简单的命令:

sudo apt-get install mysql-server 须藤apt-get install mysql-server

MySQL Download URL https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.56-linux-glibc2.5-x86_64.tar.gz MySQL下载URL https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.56-linux-glibc2.5-x86_64.tar.gz

Open the terminal and follow along: 打开终端,然后按照以下步骤操作:

  • Uninstall any existing version of MySQL 卸载任何现有版本的MySQL

    sudo rm /var/lib/mysql/ -R

  • Delete the MySQL profile 删除MySQL配置文件

    sudo rm /etc/mysql/ -R

  • Automatically uninstall mysql 自动卸载mysql

    sudo apt-get autoremove mysql* --purge sudo apt-get remove apparmor

  • Download version 5.5.51 from MySQL site 从MySQL网站下载5.5.51版

    wget https://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.56-linux-glibc2.5-x86_64.tar.gz

  • Add mysql user group 添加mysql用户组

    sudo groupadd mysql

  • Add mysql (not the current user) to mysql user group 将mysql(不是当前用户)添加到mysql用户组

    sudo useradd -g mysql mysql

  • Extract it 提取它

    sudo tar -xvf mysql-5.5.56-linux-glibc2.5-x86_64.tar.gz

  • Move it to /usr/local 将其移至/ usr / local

    sudo mv mysql-5.5.56-linux-glibc2.5-x86_64 /usr/local/

  • Create mysql folder in /usr/local by moving the untarred folder 通过移动未压缩的文件夹在/ usr / local中创建mysql文件夹

    cd /usr/local sudo mv mysql-5.5.49-linux2.6-x86_64 mysql

  • set MySql directory owner and user group 设置MySql目录所有者和用户组

    cd mysql sudo chown -R mysql:mysql *

  • Install the required lib package (works with 5.6 as well) 安装所需的lib软件包(也适用于5.6)

    sudo apt-get install libaio1

  • Execute mysql installation script 执行mysql安装脚本

    sudo scripts/mysql_install_db --user=mysql

  • Set mysql directory owner from outside the mysql directory 从mysql目录外部设置mysql目录所有者

    sudo chown -R root .

  • Set data directory owner from inside mysql directory 从mysql目录内部设置数据目录所有者

    sudo chown -R mysql data

  • Copy the mysql configuration file 复制mysql配置文件

    sudo cp support-files/my-medium.cnf /etc/my.cnf

  • Start mysql 启动mysql

    sudo bin/mysqld_safe --user=mysql & sudo cp support-files/mysql.server /etc/init.d/mysql.server

  • Set root user password 设置root用户密码

    sudo bin/mysqladmin -u root password '[your new password]'

  • Add mysql path to the system 将mysql路径添加到系统

    sudo ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql

  • Reboot! 重启!

  • Start mysql server 启动mysql服务器

    sudo /etc/init.d/mysql.server start

  • Stop mysql server 停止mysql服务器

    sudo /etc/init.d/mysql.server stop

  • Check status of mysql 检查mysql状态

    sudo /etc/init.d/mysql.server status

  • Enable myql on startup 在启动时启用myql

    sudo update-rc.d -f mysql.server defaults

*Disable mysql on startup (Optional) *在启动时禁用mysql(可选)

`sudo update-rc.d -f mysql.server remove`
  • REBOOT! 重启!

  • Now login using below command, start mysql server if it's not running already 现在使用以下命令登录,如果尚未运行mysql服务器,请启动它

    mysql -u root -p

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM