编译安装ncurses-5.9
1、解压ncurses-5.9.tar.gz
tar –xvf ncurses-5.9.tar.gz
2、编译安装ncurses-5.9
./configure
make && make install
编译安装mysql-5.5.14
1、创建用户和组
groupadd mysql
useradd mysql -g mysql
2、解压mysql-5.5.14.tar.gz
tar xvf mysql-5.5.14.tar.gz
3、编译安装mysql-5.5.14
cmake-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/data/mysql \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=all \
-DWITH_READLINE=1 \
-DWITH_SSL=bundled \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITHOUT_PARTITION_STORAGE_ENGINE=1 \
-DWITH_DEBUG=0
make && make install
4、创建mysql存放目录
mkdir -p /data/mysql
mkdir -p /data/mysqllog
chown -R mysql.mysql /data
5、建立数据表
cd /usr/local/mysql/scripts
./mysql_install_db \
--basedir=/usr/local/mysql \
--datadir=/data/mysql \
--user=mysql
6、添加自动启动
cd /usr/local/mysql/support-files
cp mysql.server /etc/init.d/mysqld
chkconfig --add mysqld --level 2345
3.3 、配置my.cnf
[mysql]
prompt=(\u@\h)[\d]>
[client]
port = 3306
socket = /tmp/mysql.sock
#default_character_set= utf8
[mysqld]
user=mysql
port = 3306
socket = /tmp/mysql.sock
datadir = /data/mysql
pid_file = /data/mysql/mysql.pid
log-bin = /data/mysqllog/mysql-bin
log-error = /data/mysqllog/mysql.err
#slow_query_log
#slow_query_log_file= /data/mysqllog/slowquery.log
#long_query_time= 0
#log-queries-not-using-indexes
binlog_format = mixed
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,NO_UNSIGNED_SUBTRACTION"
character_set_server= utf8
collation_server= utf8_bin
max_connections= 3000
max_connect_errors= 50
skip-external-locking
skip_name_resolve
lower_case_table_names=0
back_log= 128
table_open_cache= 512
open-files-limit= 65535
max_allowed_packet= 16M
thread_cache_size= 64
thread_concurrency= 8
binlog_cache_size= 1M
max_heap_table_size= 3G
tmp_table_size= 500M
read_buffer_size= 2M
read_rnd_buffer_size= 16M
sort_buffer_size= 8M
join_buffer_size= 8M
query_cache_size= 128M
query_cache_limit= 4M
event_scheduler= ON
#skip-innodb
default-storage-engine= innodb
innodb_buffer_pool_size= 8G
innodb_additional_mem_pool_size= 16M
innodb_flush_log_at_trx_commit= 2
innodb_open_files=65535
innodb_data_home_dir= /data/mysql
innodb_data_file_path= ibdata1:10M:autoextend
innodb_log_group_home_dir=/data/mysql
innodb_log_files_in_group= 2
innodb_log_buffer_size= 8M
innodb_log_file_size= 256M
innodb_flush_method=O_DIRECT
innodb_lock_wait_timeout= 120
innodb_max_dirty_pages_pct= 90
innodb_thread_concurrency= 8
key_buffer_size= 64M
bulk_insert_buffer_size= 64M
myisam_sort_buffer_size= 128M
myisam_max_sort_file_size= 10G
myisam_repair_threads= 1
myisam_recover
server-id= 1
log_bin_trust_function_creators= 1
binlog-ignore-db=mysql
binlog-ignore-db=test
wait_timeout= 864000
interactive_timeout= 864000
[mysqldump]
quick
max_allowed_packet= 16M
[mysql]
no-auto-rehash
#safe-updates
[myisamchk]
key_buffer_size= 512M
sort_buffer_size= 512M
read_buffer= 8M
write_buffer= 8M
[mysqlhotcopy]
interactive-timeout
安装完成之后,没有初始化root密码登录出现下面问题...
错误描述:
错误代码:1130
Host ***.***.***.*** is not allowed to connect to this MySQL server
解决方法:
授权法
先到mysql启动目录:cd /usr/local/mysql/bin
登录:./mysql -u root进去之后:
你想root使用root从任何主机连接到mysql服务器的话。
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
如果你想允许用户root从ip为192.168.1.3的主机连接到mysql服务器,并使用root作为密码
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.3' IDENTIFIED BY 'root' WITH GRANT OPTION;
错误描述:
错误代码1045
不要输入密码。提示输入密码直接按回车就能进去。所有的操作都可以进行。
如果想改密码很简单的。
use mysql;
update user set password=password('newpassword') where user='root';
flush privileges;