linux mysql安装问题
1、rpm -qa | grep mysql //首先检查是否安装了mysql
2、如果安装了,卸载 rpm -e mysql
3\ 下载地址
4、
5、groupadd mysql //可以先查看是否存在这个用户组 more /etc/group more /et
c/passwd
6\ useradd -g mysql mysql
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/var/mysql/data \
-DMYSQL_USER=mysql
make
make install
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/var/mysql/data \
-DMYSQL_USER=mysql
make
make install
7\ cd scripts/ mysql_install_db 初始化安装好mysql
数据库后的文件
scripts/mysql_install_db --user=mysql
安装中遇到问题
5.5.12mysql安装中
和5.1一样执行
#/usr/local/mysql/scripts/mysql_install_db --user=mysql
出现错误
FATAL ERROR: Could not find ./bin/my_print_defaults
If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.
If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
解决
/usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/mnt/mysql --user=mysql
和5.1一样执行
#/usr/local/mysql/scripts/mysql_install_db --user=mysql
出现错误
FATAL ERROR: Could not find ./bin/my_print_defaults
If you compiled from source, you need to run 'make install' to
copy the software into the correct location ready for operation.
If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
解决
/usr/local/mysql/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/mnt/mysql --user=mysql
make |
089 |
make install |
090 |
091 |
完成后进入MYSQL安装目录 |
092 |
093 |
cd /mysql/mysqldir |
094 |
cp support-files/my-huge.cnf /etc/my.cnf |
095 |
vi /etc/my.cnf |
096 |
097 |
将数据目录和套接字文件修改为实际值. |
098 |
099 |
修改权限 |
100 |
101 |
chown mysql:mysql /etc/my.cnf |
102 |
chown -R mysql:mysql /mysql/mysqldir |
103 |
104 |
切换用户进入安装目录 |
105 |
106 |
su - mysql |
107 |
cd /mysql/mysqldir |
108 |
cp scripts/mysql_install_db . |
109 |
./mysql_install_db |
110 |
111 |
启动MYSQL |
112 |
113 |
bin/mysqld_safe & |
114 |