Ubuntu下的免安装MySQL
全面转到Linux下工作了,以前windows下的一些服务,数据库都要一步步转过来了。apache,tomcat,jboss等轻松搞定,就是这个mysql
全面转到Linux下工作了,以前windows下的一些服务,数据库都要一步步转过来了。apache,tomcat,jboss等轻松搞定,就是这个mysql竟然折腾了2,3天。主要是为了保证copy过来简单配置就可以使用,所以没有使用其默认安装路径(保持windows下的习惯,Server 统一放在 myServeres目录下)。结果配置文件,,权限等折腾了半天。
好了,言归正传。首先描述下我的系统环境:Ubuntu8.04.1, 安装了build-essential 11.3 ,g++ 4.2.3
下载mysql
网址:
我下载的是5.1版的 Linux (non RPM packages) 包, windows Without installer (unzip in C:\) 包(这个包的用处下面说明).
2. 解压mysql到~/myServeres/ 下, 改目录名为 mysql51 (其实你放在哪里都行,只要你有权限)
解压 Windows Without installer (unzip in C:\) 包,将里面的data目录 复制到 mysql51目录下. (这点非常重要呀)
3. 设置mysql51 及其子目录,文件的 权限,保证你的启动mysql的用户拥有读写权限.
4. 编写启动脚本 mysql.sh, 注意依据情况修改MYSQL_HOME 的路径呀
#!/bin/bash
# Path to mySQL
MYSQL_HOME="/home/james/myServeres/mysql51"
# Check for required environment variables.
if [ -z "$MYSQL_HOME" ];
then
echo Error: MYSQL_HOME environment variable is not set.
exit 2
fi
# paser command params
case "$1" in
start)
#/var/run/mysqld/mysqld.sock
if test -e $MYSQL_HOME/mysqld.sock
#$MYSQL_HOME/bin/mysqladmin ping --socket=$MYSQL_HOME/mysqld.sock >nul 2>&1
then
echo MySQL already Start!
else
exec $MYSQL_HOME/bin/mysqld --no-defaults --user=james --basedir=$MYSQL_HOME --character-sets-dir=$MYSQL_HOME/share/charsets --language=$MYSQL_HOME/share/english --character-set-server=gb2312 --socket=$MYSQL_HOME/mysqld.sock
fi
;;
stop)
if test -e $MYSQL_HOME/mysqld.sock
#$MYSQL_HOME/bin/mysqladmin ping --socket=$MYSQL_HOME/mysqld.sock >nul 2>&1
then
echo please input mysql user name:
read name
echo please input mysql password:
read password
exec $MYSQL_HOME/bin/mysqladmin shutdown --user=$name --password=$password --socket=$MYSQL_HOME/mysqld.sock
fi
;;
*)
echo "Usage: mysql.sh {start|stop}"
;;
esac
exit 0
5. 保存mysql.sh到 mysql51目录并 赋予执行权限.
6. mysql51目录下: ./mysql.sh start
7. OK, 享受你的免安装 mysql 数据库吧。

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 reasons for MySQL installation failure are: 1. Permission issues, you need to run as an administrator or use the sudo command; 2. Dependencies are missing, and you need to install relevant development packages; 3. Port conflicts, you need to close the program that occupies port 3306 or modify the configuration file; 4. The installation package is corrupt, you need to download and verify the integrity; 5. The environment variable is incorrectly configured, and the environment variables must be correctly configured according to the operating system. Solve these problems and carefully check each step to successfully install MySQL.

The article introduces the operation of MySQL database. First, you need to install a MySQL client, such as MySQLWorkbench or command line client. 1. Use the mysql-uroot-p command to connect to the server and log in with the root account password; 2. Use CREATEDATABASE to create a database, and USE select a database; 3. Use CREATETABLE to create a table, define fields and data types; 4. Use INSERTINTO to insert data, query data, update data by UPDATE, and delete data by DELETE. Only by mastering these steps, learning to deal with common problems and optimizing database performance can you use MySQL efficiently.

MySQL installation failure is usually caused by the lack of dependencies. Solution: 1. Use system package manager (such as Linux apt, yum or dnf, Windows VisualC Redistributable) to install the missing dependency libraries, such as sudoaptinstalllibmysqlclient-dev; 2. Carefully check the error information and solve complex dependencies one by one; 3. Ensure that the package manager source is configured correctly and can access the network; 4. For Windows, download and install the necessary runtime libraries. Developing the habit of reading official documents and making good use of search engines can effectively solve problems.

How to correct the error in MySQL database file path setting: 1. Stop MySQL service; 2. Strongly recommend backing up data; 3. Modify the datadir parameter in the configuration file to the correct path, and ensure that MySQL users have read and write permissions; 4. It is recommended to create a new data directory; 5. Start MySQL service; 6. Verify whether the database is running normally and data integrity. Be sure to operate with caution to avoid data loss.

Common reasons and solutions for MySQL installation failure: 1. Incorrect username or password, or the MySQL service is not started, you need to check the username and password and start the service; 2. Port conflicts, you need to change the MySQL listening port or close the program that occupies port 3306; 3. The dependency library is missing, you need to use the system package manager to install the necessary dependency library; 4. Insufficient permissions, you need to use sudo or administrator rights to run the installer; 5. Incorrect configuration file, you need to check the my.cnf configuration file to ensure the configuration is correct. Only by working steadily and carefully checking can MySQL be installed smoothly.

The solution to the MySQL repeated installation prompt is to completely remove the remaining traces: 1. Use the control panel to uninstall relevant programs; 2. Manually delete files and registry entries in the MySQL installation directory (backup before operation); 3. Stop and delete MySQL-related services in the system service; 4. Restart the computer. In addition, it is recommended to use professional uninstall tools, check environment variables, select official installation packages and clear installation paths to avoid this problem again.

Installing MySQL on macOS can be achieved through the following steps: 1. Install Homebrew, using the command /bin/bash-c"$(curl-fsSLhttps://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)". 2. Update Homebrew and use brewupdate. 3. Install MySQL and use brewinstallmysql. 4. Start MySQL service and use brewservicesstartmysql. After installation, you can use mysql-u

Installing MySQL on Linux can be done through the package manager. The specific steps are as follows: 1. On Ubuntu, use apt to update the package list and install the MySQL server; 2. On CentOS, use yum to install the MySQL community version and start the service. After installation, basic configuration needs to be performed, such as setting the root password and creating database and users.
