Ubuntu Server 12.04 安装mysql 5.6.10_MySQL
UbuntuServerUbuntu
bitsCN.com第一次接触服务器版Linux,也是第一次用命令行安装二进制mysql,两天一夜,比较痛苦。留做备忘!
首先,下载二进制版本的mysql包: http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.10-linux-glibc2.5-x86_64.tar.gz
因为Ubuntu Server上 wget比较慢,所以我是直接在windows用迅雷下载好,然后WinSCP上传到服务器的,看各自喜好了。
上正题。
包放在~/Download目录下,全部安装命令如下:
1、解压tar.gz
tar –xzf mysql-5.6.10-linux-glibc2.5-x86_64.tar.gz
2、重命名解压的文件夹
mv mysql-5.6.10-linux-glibc2.5-x86_64 mysql
3、将mysql文件夹移动到/usr/local目录下
sudo mv mysql /usr/local
4、进入mysql目录
cd /usr/local/mysql
5、增加mysql用户组
sudo groupadd mysql
6、增加mysql用户
sudo useradd -r -g mysql mysql
7、将mysql文件夹own及grp变更为mysql
sudo chown -R mysql .
sudo chgrp -R mysql .
8、执行mysql安装脚本
sudo scripts/mysql_install_db --user=mysql
(若未安装libaio包,会有一个报错提示,安装libaio-dev后,再运行脚本即可)
sudo apt-get install libaio-dev
9、将目录权限变更回来,仅保留data目录为mysql用户
sudo chown -R root .
sudo chown -R mysql data
10、将mysql配置文件拷贝到etc目录(全局配置)
注意:5.6版本的默认配置文件名称由原先的my-medium变更为了my-default。
sudo cp support-files/my-default.cnf /etc/my.cnf
11、启动mysql
sudo bin/mysqld_safe --user=mysql &
12、初始化mysql root用户密码
sudo bin/mysqladmin -u root password '密码文字'
13、复制mysql.server脚本到/etc/init.d(初始化服务,有些人喜欢改成mysqld,在这里改就可以)
sudo cp support-files/mysql.server /etc/init.d/mysql.server
14、查看mysql运行状态
sudo service mysql.server status
如果运行正常,会显示 MySQL running。
如果显示 not running,应该是前面没有启动服务,可直接用service mysql.server start启动
sudo service mysql.server [status|start|stop]
15、让mysql开机启动[defaults],取消开机启动[remove]
sudo update-rc.d -f mysql.server defaults [remove]
16、将mysql/bin/mysql命令加入到用户命令中,或将mysql/bin目录加入path
加入用户命令:
sudo ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
加入环境变量:
export PATH=$PATH:/usr/local/mysql/bin
17、允许root用户远程登录
1>进入mysql: mysql –u root –p
2>改变数据库: use mysql;
3>从任意主机登录: grant all privileges on *.* to root@"%" identified by "密码文字" with grant option;
4>从指定主机登录: grant all privileges on *.* to root@"192.168.1.101" identified by "passw0rd" with grant option;
5>授权生效: flush privileges;
6>查看host为%授权是否添加: select * from user;
18、找个客户端去试试吧。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics





The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

Laravel is a PHP framework for easy building of web applications. It provides a range of powerful features including: Installation: Install the Laravel CLI globally with Composer and create applications in the project directory. Routing: Define the relationship between the URL and the handler in routes/web.php. View: Create a view in resources/views to render the application's interface. Database Integration: Provides out-of-the-box integration with databases such as MySQL and uses migration to create and modify tables. Model and Controller: The model represents the database entity and the controller processes HTTP requests.

I encountered a tricky problem when developing a small application: the need to quickly integrate a lightweight database operation library. After trying multiple libraries, I found that they either have too much functionality or are not very compatible. Eventually, I found minii/db, a simplified version based on Yii2 that solved my problem perfectly.

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

To set the shortcut keys for Sublime Text, follow these steps: Open the shortcut key settings file Key Bindings - User. Add shortcut key settings using the format { "keys": ["key combination"], "command": "command" }. Save changes. Reload the shortcut key settings for the changes to take effect.

Installing Git software includes the following steps: Download the installation package and run the installation package to verify the installation configuration Git installation Git Bash (Windows only)

There are many ways to customize a development environment, but the global Git configuration file is one that is most likely to be used for custom settings such as usernames, emails, preferred text editors, and remote branches. Here are the key things you need to know about global Git configuration files.
