源碼編譯Mysql

來源:互聯網
上載者:User

標籤:mysql

環境:CentOS 6.5

[[email protected] software]# yum -y install gcc gcc-c++[[email protected] software]# tar -zxvf cmake-2.8.5.tar.gz[[email protected] software]# cd cmake-2.8.5[[email protected] cmake-2.8.5]# ./configure --prefix=/usr/local/cmake···CMake has bootstrapped.  Now run gmake.[[email protected] cmake-2.8.5]# gmake[[email protected] cmake-2.8.5]# make install[[email protected] software]# yum -y install bison ncurses-devel[[email protected] software]# useradd mysql -s /sbin/nologin[[email protected] software]# tar -zxvf mysql-5.5.25.tar.gz[[email protected] software]# cd mysql-5.5.25[[email protected] mysql-5.5.25]# mkdir -p /usr/local/mysql/data[[email protected] mysql-5.5.25]# mkdir -p /usr/local/mysql/etc[[email protected] mysql-5.5.25]# mkdir -p /usr/local/mysql/log[[email protected] mysql-5.5.25]# /usr/local/cmake/bin/cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/usr/local/mysql/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_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/usr/local/mysql/data[[email protected] mysql-5.5.25]# make &&make install[[email protected] mysql-5.5.25]# make clean &&rm -rf CMakeCache.txt /etc/my.cnf[[email protected] mysql-5.5.25]# chown mysql:mysql /usr/local/mysql/ -R[[email protected] mysql-5.5.25]# cd /usr/local/mysql/[[email protected] mysql]# cp support-files/my-medium.cnf /usr/local/mysql/etc/my.cnf[[email protected] mysql-5.5.25]# cp support-files/mysql.server /etc/init.d/mysqld[[email protected] mysql-5.5.25]# /usr/local/mysql/scripts/mysql_install_db --defaults-file=/usr/local/mysql/etc/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/ --user=mysql        //初始化mysql資料庫[[email protected] ~]# chmod +x /etc/init.d/mysqld[[email protected] ~]# head -n 47 /etc/init.d/mysqld |tail -n 2basedir="/usr/local/mysql"datadir="/usr/local/mysql/data"[[email protected] ~]# /etc/init.d/mysqld startStarting MySQL... SUCCESS![[email protected] ~]#
[[email protected] ~]# chkconfig mysqld on[[email protected] ~]# netstat -tunlp|grep mysqldtcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      1451/mysqld[[email protected] ~]#[[email protected] ~]# /usr/local/mysql/bin/mysqladmin -u root password redhat              //剛裝完資料庫用這個命令給root使用者佈建密碼

[[email protected] ~]# /usr/local/mysql/bin/mysql -u root -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.5.25-log Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql>


修改root使用者密碼:

在外部修改root使用者密碼:

[[email protected] ~]# /usr/local/mysql/bin/mysqladmin -u root -p password "redhat"Enter password: [輸入原來的密碼][[email protected] ~]#

在MYSQL資料庫裡面修改root使用者密碼:

[[email protected] ~]# /usr/local/mysql/bin/mysql -u root -p

Enter password:[輸入原來的密碼]

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 9

Server version: 5.5.25-log Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql> use mysql;Database changedmysql> update user set password=password(‘redhat123‘) where user=‘root‘;Query OK, 4 rows affected (0.01 sec)Rows matched: 4  Changed: 4  Warnings: 0mysql> quitBye[[email protected] ~]# ln -s /usr/local/mysql/bin/* /bin/

本文出自 “鵬城-醬油瓶” 部落格,謝絕轉載!

源碼編譯Mysql

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.