源码安装MySQL
【MySQL】源码编译安装和配置MySql5.5.32(单实例)
【MySQL】源码编译安装和配置MySql5.5.32(单实例)【需求描述】在CentOS环境中,通过编译源码的⽅式,安装并且配置“单实例”的MySQL5.5.32数据库。
MySQL的安装⽬录为:/application/mysql-5.5.32MySQL数据⽂件的安装⽬录为:/application/mysql-5.5.32/dataMySQL默认的字符编码为:UTF8【环境参数】VMware:10.0.1Host:Win7DB:MySql 5.5.32编译⼯具:cmake-2.8.8.tar.gz其他依赖:ncurses-devel-5.7-3.20090208.el6.x86_64.rpmClient:CentOS 6.5 x86_64,i686,最⼩化安装(Minimal)。
在安装⾃定义组件包时,(1)Base System只安装了Base,Compatibility Libraries和Debugging Tools。
(2)Development只安装了Development Tools。
【软件下载】(1)MySql下载地址:选择“Generic Linux (Architecture Independent), Compressed TAR Archive”这个版本的来下载。
(2)下载cmakeCMake是⼀个跨平台的安装(编译)⼯具,可以⽤简单的语句来描述所有平台的安装(编译过程)。
他能够输出各种各样的makefile或者project⽂件,能测试编译器所⽀持的C++特性,类似UNIX下的automake。
只是 CMake 的组态档取名为 CmakeLists.txt。
(3)下载ncurse-devel依赖包的百度云盘分享:【具体步骤】1、查看系统环境[root@centos65-mini ~]# cat /etc/redhat-releaseCentOS release 6.5 (Final)[root@centos65-mini ~]#[root@centos65-mini ~]#[root@centos65-mini ~]# uname -r2.6.32-431.el6.x86_64[root@centos65-mini ~]#2、安装相关软件包(1) 配置、编译和安装cmake编译⼯具①在当前⽬录,解压缩cmake-2.8.8.tar.gz# tar –zxvf cmake-2.8.8.tar.gz②从当前⽬录切换到cmake-2.8.8⽬录中,# cd cmake-2.8.8③执⾏命令“#./configure”来配置cmake⼯具。
mysql.data源码编译
MySQL的源码编译涉及到多个步骤,下面是一个基本的指南,用于从源代码编译MySQL。
请注意,这只是一个简化的指南,实际的编译过程可能更复杂,取决于您的操作系统和特定需求。
准备工作:确保您的系统已安装以下工具和库: gcc, gcc-c++, zlib, openssl, ncurses, libaio, libssl。
获取MySQL的源代码。
您可以从MySQL的官方网站或其GitHub存储库下载。
解压源码:bashtar -zxvf mysql-source-version.tar.gzcd mysql-source-version编译前配置:bashmkdir bldcd bld../configure --with-mysqld-user=mysql --with-extra-charsets=all --with-ssl --with-zlib --enable-local-infile --with-readline --with-plugins=all --prefix=/path/to/mysql_installation编译和安装:bashmake -j$(nproc)make install初始化数据库:bashcd ..bin/mysqld --initialize --user=mysql启动MySQL服务:为了运行MySQL服务器,您需要启动一个后台进程。
您可以使用以下命令:bashbin/mysqld_safe --user=mysql &连接到MySQL服务器:使用MySQL客户端连接到服务器:bashbin/mysql -u root -p其他配置和优化: 根据您的需求,您可能还需要进行其他配置和优化步骤,例如调整f 配置文件。
添加到系统服务(可选): 如果您想让MySQL在系统启动时自动运行,您可以将其添加到系统服务。
具体的步骤取决于您的操作系统。
安装后检查与测试: 进行一些常规的测试,以确保您的MySQL安装正常工作。
mysql5.7.4数据库源码安装20150520
mysql数据库源码安装1、安装环境系统: Red Hat Enterprise Linux Server release 6.4 (Santiago)64位CUP 4核内存8G硬盘空间160G系统分区 /boot 300M /swap 4096M /home 102400M把剩余全部空间分给根分区。
mysql源码包版本:mysql-5.7.4-m14.tar.gz2 、升级cmake到2.8.9版本查看系统cmake 版本rpm -qa cmake 或cmake --version[root@gztestC118 home]# rpm -qa cmakecmake-2.6.4-5.el6.x86_64[root@gztestC118 home]# cmake --versioncmake version 2.6-patch 4[root@gztestC118 home]#rpm -e cmake-2.6.4-5.el6.x86_64 删除旧的cmake[root@gztestC118 home]# tar –zxvf cmake-2.8.9.tar.gz[root@gztestC118 home]# cd cmake-2.8.9[root@gztestC118 home]./configure[root@gztestC118 home]make &&make install[root@gztestC118 ~]# cmake –version 检查新版本号cmake version 2.8.9 升级成功。
3、拷贝好RHEL系统镜像进入目录Packages[root@gztestC117 Packages]# ll *curses* 把下面安装包安装下。
-r--r--r--. 1 root root 274016 5月 12 06:16 ncurses-5.7-3.20090208.el6.x86_64.rpm-r--r--r--. 1 root root 62400 5月 12 06:16 ncurses-base-5.7-3.20090208.el6.x86_64.rpm-r--r--r--. 1 root root 656772 5月 12 06:16 ncurses-devel-5.7-3.20090208.el6.i686.rpm-r--r--r--. 1 root root 657088 5月 12 06:16 ncurses-devel-5.7-3.20090208.el6.x86_64.rpm-r--r--r--. 1 root root 256596 5月 12 06:16 ncurses-libs-5.7-3.20090208.el6.i686.rpm-r--r--r--. 1 root root 251756 5月 12 06:16 ncurses-libs-5.7-3.20090208.el6.x86_64.rpm-r--r--r--. 1 root root 559700 5月 12 06:16 ncurses-term-5.7-3.20090208.el6.x86_64.rpm [root@gztestC117 Packages]# rpm -ivh ncurses-5.7-3.20090208.el6.x86_64.rpmwarning: ncurses-5.7-3.20090208.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEYPreparing... ########################################### [100%] package ncurses-5.7-3.20090208.el6.x86_64 is already installed[root@gztestC117 Packages]# rpm -ivh ncurses-base-5.7-3.20090208.el6.x86_64.rpmwarning: ncurses-base-5.7-3.20090208.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEYPreparing... ########################################### [100%] package ncurses-base-5.7-3.20090208.el6.x86_64 is already installed[root@gztestC117 Packages]# rpm -ivh ncurses-devel-5.7-3.20090208.el6.x86_64.rpmwarning: ncurses-devel-5.7-3.20090208.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEYPreparing... ########################################### [100%] 1:ncurses-devel ########################################### [100%] [root@gztestC117 Packages]# rpm -ivh ncurses-libs-5.7-3.20090208.el6.x86_64.rpmwarning: ncurses-libs-5.7-3.20090208.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key IDfd431d51: NOKEYPreparing... ########################################### [100%] package ncurses-libs-5.7-3.20090208.el6.x86_64 is already installed[root@gztestC117 Packages]# rpm -ivh ncurses-term-5.7-3.20090208.el6.x86_64.rpmwarning: ncurses-term-5.7-3.20090208.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEYPreparing... ########################################### [100%] 1:ncurses-term ########################################### [100%]利用新安装的cmake指定mysql安装路径解压mysql包,进入mysql源目录cmake -DCMAKE_INSTALL_PREFIX=/home/mysqlinstall/mysql如果未安装curses相关包则会报错CMake Error at cmake/readline.cmake:64 (MESSAGE):Curses library not found. Please install appropriate package。
学生信息管理系统完整源代码+mysql文件
数据库所用的数据自己导入MYSQL5.5,Navicat8就可以用了。
下面是具体的数据资料/*MySQL Data TransferSource Host: localhostSource Database: simsTarget Host: localhostTarget Database: simsDate: 2013-6-25 9:24:26*/SET FOREIGN_KEY_CHECKS=0;-- ------------------------------ Table structure for manager-- ----------------------------DROP TABLE IF EXISTS `manager`;CREATE TABLE `manager` (`id` varchar(10) NOT NULL,`name` varchar(30) NOT NULL,`Mima` varchar(20) NOT NULL,PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;-- ------------------------------ Table structure for studentinfo-- ----------------------------DROP TABLE IF EXISTS `studentinfo`;CREATE TABLE `studentinfo` (`Sname` varchar(30) NOT NULL,`Ssex` varchar(10) NOTNULL,`Snumber` varchar(10) NOT NULL,`Sprofession` varchar(30) NOT NULL,`Sclass`varchar(20) NOT NULL,`Sdate` varchar(30) character set utf8 collate utf8_unicode_ciNOT NULL,PRIMARY KEY (`Snumber`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='InnoDBfree: 4096 kB';-- ------------------------------ Table structure for userinfo-- ----------------------------DROP TABLE IF EXISTS `userinfo`;CREATE TABLE `userinfo` (`id` varchar(10) NOT NULL,`name` varchar(30) NOT NULL,`Mima` varchar(20) character set utf8 collate utf8_unicode_ci NOT NULL, PRIMARY KEY(`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;-- ------------------------------ Records-- ----------------------------INSERT INTO `manager` VALUES ('1', '1', '2');INSERT INTO `manager` VALUES ('2', '恩恩', '123456');INSERT INTO `manager` VALUES ('3', '大大', '123456');INSERT INTO `manager` VALUES ('4', '啊啊', '123456');INSERT INTO `manager` VALUES ('5', '5', '5');INSERT INTO `manager` VALUES ('6', '孙霞', '123456');INSERT INTO `studentinfo` V ALUES ('张三', '男', '2010303755', '数学', '2', '2010-02- 12');INSERT INTO `studentinfo` V ALUES ('李四', '男', '2010303760', '物理', '1', '1995.9.6'); INSERT INTO `studentinfo` V ALUES ('王二', '女', '2010303761', '应数', '2','1990.9.11');INSERT INTO `studentinfo` V ALUES ('麻子', '女', '2010303762', '信计', '1','1999.9.10');INSERT INTO `userinfo` V ALUES ('1', '1', '1');INSERT INTO `userinfo` V ALUES ('13', '13', '1');INSERT INTO `userinfo` V ALUES ('2', '2', '2');INSERT INTO `userinfo` V ALUES ('3', '3', '3');INSERT INTO `userinfo` V ALUES ('6', '6', '6');INSERT INTO `userinfo` V ALUES ('7', '7', '6');下面是相应的程序:package MS;import java.awt.event.ActionEvent;import java.awt.event.ActionListener; import java.awt.Color;import java.awt.Container;import java.awt.Dimension;import java.awt.GridLayout;import java.awt.Toolkit;import java.awt.event.FocusEvent;import java.awt.event.FocusListener;import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JTextField;import javax.swing.SwingConstants;public class Add implements ActionListener {JFrame f1;Container ct;JPanel jp,jp1,jp2,jp3;JButton btn1,btn2;JLabel label;JTextField tf1,tf2,tf3,tf4,tf5,tf6;Add(){f1=new JFrame();ct=f1.getContentPane();//初始化面板jp=new JPanel();jp1=new JPanel(new GridLayout(6,1));jp2=new JPanel(new GridLayout(6,1));jp3=new JPanel();btn1=new JButton("确定");btn2=new JButton("取消");label=new JLabel("<html><font color=#CC00FF size='4'>添加学生信息</font>",SwingConstants.CENTER);label.setForeground(Color.gray);tf1=new JTextField(20);tf2=new JTextField(20);tf3=new JTextField(20);tf4=new JTextField(20);tf5=new JTextField(20);tf6=new JTextField(20);tf6.setText("例:2000-02-02");//文本框加入提示语tf6.addFocusListener(new FocusListener(){public void focusGained(FocusEvent e) {tf6.setText("");}public void focusLost(FocusEvent e) {}});jp.add(label);ct.add(jp,"North");jp1.add(new JLabel("姓名",SwingConstants.CENTER));jp2.add(tf1);jp1.add(new JLabel("性别",SwingConstants.CENTER));jp2.add(tf2);jp1.add(new JLabel("学号",SwingConstants.CENTER));jp2.add(tf3);jp1.add(new JLabel("专业",SwingConstants.CENTER));jp2.add(tf4);jp1.add(new JLabel("班级",SwingConstants.CENTER));jp2.add(tf5);jp1.add(new JLabel("入学时间",SwingConstants.CENTER));jp2.add(tf6);jp3.add(btn1);jp3.add(btn2);ct.add(jp1,"West");ct.add(jp2,"East");ct.add(jp3,"South");Toolkit kit=Toolkit.getDefaultToolkit();Dimension screen=kit.getScreenSize();int x=screen.width;int y=screen.height;f1.setSize(350,330);int xcenter=(x-350)/2;int ycenter=(y-330)/2;f1.setLocation(xcenter, ycenter);f1.setVisible(true);//f1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);btn1.addActionListener(this);btn2.addActionListener(this);}public void insert(){if(tf1.getText().equals("")||tf2.getText().equals("")||tf3.getText().equals("")||tf4.getText().equals("")||tf5.getText().equals("")||tf6.getText().equals("")){JOptionPane.showMessageDialog(f1,"请填写完整信息");return;}try{Class.forName("com.mysql.jdbc.Driver");}catch(ClassNotFoundException e){System.out.print("加载驱动程序失败");}String conURL="jdbc:mysql://localhost:3306/sims";try{Connectioncon=DriverManager.getConnection(conURL,"root","123456");Statement st=con.createStatement();String s="insert into studentinfo values('"+tf1.getText()+"','"+tf2.getText()+"','"+tf3.getText()+"','"+tf4.getText()+"','"+tf5.getText()+"','"+tf6.getText()+"');";String query="select * from studentinfo where Snumber='"+tf3.getText().trim()+"'";ResultSet res=st.executeQuery(query);if(res.next()){JOptionPane.showMessageDialog(f1,"学号信息已经存在!");con.close();tf3.setText("");}else if(tf6.getText().length()!=10){JOptionPane.showMessageDialog(f1,"入学时间格式有误!");con.close();tf6.setText("");}int insert=st.executeUpdate(s);if(insert==1){JOptionPane.showMessageDialog(f1,"录入信息成功!");tf1.setText("");tf2.setText("");tf3.setText("");tf4.setText("");tf5.setText("");tf6.setText("");}}catch(SQLException e){System.out.println("错误代码:"+e.getErrorCode());System.out.println("错误信息:"+e.getMessage());}}@SuppressWarnings("deprecation")public void actionPerformed(ActionEvent e){String cmd=e.getActionCommand();if(cmd.equals("确定")){insert();}else if(cmd.equals("取消")){f1.hide();}}public Container getCt(){return ct;}public void setCt(Container ct){this.ct = ct;}}package MS;import java.awt.BorderLayout;import java.awt.Color;import java.awt.Container;import java.awt.Dimension;import java.awt.Toolkit;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTable;import javax.swing.JTextField;import javax.swing.SwingConstants;public class Delete implements ActionListener {JFrame f2;Container ct;JPanel jp1,jp2,jp3,jp4;JLabel label;JTextField text;JTable table;//接收数据库中返回的信息JButton btn1,btn2,btn3;Object columnName[]={"姓名","性别","学号","专业","班级","入学时间"};Object ar[][]=new Object[80][6];Delete(){f2=new JFrame();ct=f2.getContentPane();jp1=new JPanel();jp2=new JPanel();jp3=new JPanel();jp4=new JPanel();label=new JLabel();text=new JTextField();btn1=new JButton("查询");btn2=new JButton("删除");btn3=new JButton("取消");label=new JLabel("<html><font color=#CC00FF size='4'>请输入要删除的学生姓名:</font>",SwingConstants.CENTER);label.setBackground(Color.blue);table=new JTable(ar,columnName);JScrollPane scroll=new JScrollPane(table);text=new JTextField(20);jp2.add(btn1);jp2.add(btn2);jp2.add(btn3);jp1.add(label);jp1.add(text);ct.add(jp1,"North");jp3.setLayout(new BorderLayout());jp3.add(new JLabel("学生信息如下"));jp3.add(scroll);ct.add(jp2,"South");ct.add(jp3,"Center");Toolkit kit=Toolkit.getDefaultToolkit();Dimension screen=kit.getScreenSize();int x=screen.width;int y=screen.height;f2.setSize(450, 400);int xcenter=(x-450)/2;int ycenter=(y-400)/2;f2.setLocation(xcenter, ycenter);f2.setVisible(true);//f2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);btn1.addActionListener(this);btn2.addActionListener(this);btn3.addActionListener(this);}int i=0;public void show(String s){while(i>=0){ar[i][0]="";ar[i][1]="";ar[i][2]="";ar[i][3]="";ar[i][4]="";ar[i][5]="";i--;}i=0;try{Class.forName("com.mysql.jdbc.Driver");}catch(ClassNotFoundException e){System.out.print("加载驱动程序失败");}String conURL="jdbc:mysql://localhost:3306/sims";try{Connection con=DriverManager.getConnection(conURL,"root","123456");Statement st=con.createStatement();String sql="select * from studentinfo where Sname='"+s+"'";ResultSet res=st.executeQuery(sql);/*if(!(res.next())){JOptionPane.showMessageDialog(f,"所要查询的信息不存在");} */while(res.next()){String sName=res.getString(1);String sSex=res.getString(2);String sNumber=res.getString(3);String sProfession=res.getString(4);String sClass=res.getString(5);String sDate=res.getString(6);ar[i][0]=sName;ar[i][1]=sSex;ar[i][2]=sNumber;ar[i][3]=sProfession;ar[i][4]=sClass;ar[i][5]=sDate;i++;}f2.repaint();con.close();}catch(SQLException e){System.out.println("错误代码:"+e.getErrorCode());System.out.println("错误信息:"+e.getMessage());}}public void delete(int line){try{Class.forName("com.mysql.jdbc.Driver");}catch(ClassNotFoundException e){System.out.print("加载驱动程序失败");}String conURL="jdbc:mysql://localhost:3306/sims";try{Connection con=DriverManager.getConnection(conURL,"root","123456");Statement st=con.createStatement();String name=(String)(ar[line][2]);String sql="delete from studentinfo where Snumber ='"+name+"'";int del=st.executeUpdate(sql);if(del==1){ar[line][0]="";ar[line][1]="";ar[line][2]="";ar[line][3]="";ar[line][4]="";ar[line][5]="";JOptionPane.showMessageDialog(null,"删除成功!","信息", JOptionPane.YES_NO_OPTION);}con.close();f2.repaint();}catch(SQLException e){System.out.println("错误代码:"+e.getErrorCode());System.out.println("错误信息:"+e.getMessage());}}@SuppressWarnings("deprecation")public void actionPerformed(ActionEvent e){String cmd=e.getActionCommand();if(cmd.equals("查询")){String qu=text.getText().trim();show(qu);}if(cmd.equals("删除")){int de=table.getSelectedRow();if(de==-1){JOptionPane.showMessageDialog(null,"请选定要删除的行","错误信息", JOptionPane.YES_NO_OPTION);}else{delete(de);}}if(cmd.equals("取消")){f2.hide();}}}package MS;import java.awt.Color;import java.awt.Container;import java.awt.Dimension;import java.awt.Toolkit;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.JTable;import javax.swing.SwingConstants;public class Liulan implements ActionListener {JFrame f4;Container ct;JPanel jp1,jp2,jp3,jp4;JLabel label;JButton btn1,btn2;JTable table;Object[][] ar=new Object[80][6];Object[] columnName={"姓名","性别","学号","专业","班级","入学时间"};Liulan(){f4=new JFrame();ct=f4.getContentPane();jp1=new JPanel();jp2=new JPanel();jp3=new JPanel();jp4=new JPanel();btn1=new JButton("点击浏览");btn2=new JButton(" 取消");label=new JLabel("<html><font color=#00FF22 size='4'>学生信息浏览<font>",SwingConstants.CENTER);label.setBackground(Color.blue);table=new JTable(ar, columnName);JScrollPane scroll=new JScrollPane(table);jp1.add(label);jp2.add(btn1);jp2.add(btn2);jp3.add(scroll);ct.add(jp1,"North");ct.add(jp3,"Center");ct.add(jp2,"South");Toolkit kit=Toolkit.getDefaultToolkit();Dimension screen=kit.getScreenSize();int x=screen.width;int y=screen.height;f4.setSize(500,530);int xcen=(x-500)/2;int ycen=(y-530)/2;f4.setLocation(xcen,ycen);f4.setVisible(true);btn1.addActionListener(this);btn2.addActionListener(this);}int i=0;public void select(){while(i>=0){ar[i][0]="";ar[i][1]="";ar[i][2]="";ar[i][3]="";ar[i][4]="";ar[i][5]="";i--;}i=0;try{Class.forName("com.mysql.jdbc.Driver");}catch(ClassNotFoundException e){System.out.print("加载驱动程序失败");}String conURL="jdbc:mysql://localhost:3306/sims";try{Connection con=DriverManager.getConnection(conURL,"root","123456");Statement st=con.createStatement();String s="select * from studentinfo";ResultSet res=st.executeQuery(s);while(res.next()){String sName=res.getString(1);String sSex=res.getString(2);String sNumber=res.getString(3);String sProfession=res.getString(4);String sClass=res.getString(5);String sDate=res.getString(6);ar[i][0]=sName;ar[i][1]=sSex;ar[i][2]=sNumber;ar[i][3]=sProfession;ar[i][4]=sClass;ar[i][5]=sDate;i++;}f4.repaint();con.close();}catch(SQLException e){System.out.println("错误代码:"+e.getErrorCode());System.out.println("错误信息:"+e.getMessage());}}@SuppressWarnings("deprecation")public void actionPerformed(ActionEvent e){// TODO Auto-generated method stubString cmd=e.getActionCommand();if(cmd.equals("点击浏览")){select();}else if(cmd.equals(" 取消")){f4.hide();}}}package MS;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.Color;import java.awt.Container;import java.awt.Dimension;import java.awt.Toolkit;import java.awt.event.ItemEvent;import java.awt.event.ItemListener;import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import java.sql.Connection;import java.sql.DriverManager;import javax.swing.ButtonGroup;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JPasswordField;import javax.swing.JRadioButton;import javax.swing.JTextField;import javax.swing.SwingConstants;@SuppressWarnings("serial")public class Login extends JFrame implements ActionListener {Container cp=null;JFrame f=null;JButton button1,button2,button3;JTextField t1;JPasswordField t2;JLabel jlable1,jlable2;JRadioButton rabtn1,rabtn2;Color c;JPanel jp1,jp2,jp3;String table=null;Login(){f=new JFrame("学生信息管理系统");button1=new JButton("确定");button2=new JButton("取消");button3=new JButton("注册");//button3.setOpaque(false);button3.setBorder(null);button3.setBackground(Color.getColor("#292421"));rabtn1=new JRadioButton("普通用户");rabtn1.setBackground(Color.getColor("#292421"));rabtn2=new JRadioButton("管理员");rabtn2.setBackground(Color.getColor("#292421"));ButtonGroup group=new ButtonGroup();group.add(rabtn1);group.add(rabtn2);cp=f.getContentPane();jlable1=new JLabel("输入用户号");jlable2=new JLabel("输入密码");jp1=new JPanel();jp2=new JPanel();jp3=new JPanel();t1=new JTextField(20);t2=new JPasswordField(20);//jp3.add(group);jp1.add(jlable1);jp1.add(t1);jp1.add(jlable2);jp1.add(t2);jp1.add(rabtn1);jp1.add(rabtn2);jp1.add(button3);JLabel JL=new JLabel("<html><font color=#292421 size='7'><i>欢迎登陆" + "</i></font>",SwingConstants.CENTER);cp.add(JL,"North");jp2.add(button1);jp2.add(button2);cp.add(jp1,"Center");cp.add("South",jp2);cp.setBackground(new Color(127, 255, 212 ));jp2.setBackground(new Color(127, 255, 212 ));jp1.setBackground(new Color(127, 255, 212 ));Toolkit kit=Toolkit.getDefaultToolkit();Dimension screen=kit.getScreenSize();int x=screen.width;int y=screen.height;f.setSize(250,300);int xcenter=(x-300)/2;int ycenter=(y-300)/2;f.setLocation(xcenter,ycenter);/*显示在窗口中央*/f.setVisible(true);//f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);//------------------------------------------------------------///*监听事件*/button1.addActionListener(this);button2.addActionListener(this);button3.addActionListener(this);rabtn1.addItemListener(new ItemListener(){public void itemStateChanged(ItemEvent e){JRadioButton jop=(JRadioButton) e.getSource();if (jop.isSelected())table="userinfo";}});rabtn2.addItemListener(new ItemListener(){public void itemStateChanged(ItemEvent e){JRadioButton jop=(JRadioButton) e.getSource();if (jop.isSelected())table="manager";}});f.addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent e){System.exit(0);}});}@SuppressWarnings("deprecation")public void confirm(String tableName){try{Class.forName("com.mysql.jdbc.Driver");}catch(ClassNotFoundException e){System.out.print("加载驱动程序失败");}String conURL="jdbc:mysql://localhost:3306/sims";try{Connection con=DriverManager.getConnection(conURL,"root","123456");Statement st=con.createStatement();String id=t1.getText().trim();String Mima=t2.getText().trim();String queryMima="select * from "+tableName+" where id='"+id+"' and mima='"+Mima+"'";ResultSet res=st.executeQuery(queryMima);if(res.next()){if(tableName.equals("manager"))new Mstudent(id);else if(tableName.equals("userinfo"))new Ustudent(id);f.hide();con.close();}else{JOptionPane.showMessageDialog(null,"密码错误请重输!!!","提示!",JOptionPane.YES_NO_OPTION);}t1.setText("");t2.setText("");}catch(SQLException g){System.out.println("错误代码:"+g.getErrorCode());System.out.println("错误内容:"+g.getMessage());}}ItemListener listen=new ItemListener(){public void itemStateChanged(ItemEvent e) {// TODO Auto-generated method stub}};public void actionPerformed(ActionEvent e){String cmd=e.getActionCommand();if(cmd.equals("确定")){if(table==null){JOptionPane.showMessageDialog(f,"请选择用户类型");}confirm(table);}else if(cmd.equals("取消")){f.dispose();}else if(cmd.equals("注册")){new Regist();}}public static void main(String []arg){new Login();}}package MS;import java.awt.BorderLayout;import java.awt.Color;import java.awt.Container;import java.awt.Dimension;import java.awt.Toolkit;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import javax.swing.BorderFactory;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JMenuBar;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JScrollPane;import javax.swing.SwingConstants;import javax.swing.border.TitledBorder;@SuppressWarnings("serial")public class Mstudent extends JFrame implements ActionListener {JButton Query = new JButton("查询信息");JButton add = new JButton("添加信息");JButton delete = new JButton("删除信息");JButton xiugai = new JButton("浏览全部信息");JButton liulan = new JButton("修改密码");JMenuBar mb = new JMenuBar();// 菜单栏JPanel jp = new JPanel();Container cp = getContentPane();String userName;Mstudent(){}Mstudent(String userName){erName = userName;mb.add(Query);mb.add(add);mb.add(delete);mb.add(xiugai);mb.add(liulan);JPanel j=new JPanel();j.add(mb,"Center");cp.add(j, "North");// 设置边框jp.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.blue, 2), null, TitledBorder.CENTER,TitledBorder.TOP));jp.setLayout(new BorderLayout());JLabel label1 = new JLabel("欢迎使用学生信息管理系统",SwingConstants.CENTER);jp.add(label1);JScrollPane scrollpane = new JScrollPane(jp);cp.add(scrollpane,"Center");setTitle("欢迎登陆" + "--" + "你好:" + userName);Toolkit kit = Toolkit.getDefaultToolkit();Dimension screen = kit.getScreenSize();int x = screen.width; /* 取得显示器窗口的宽度*/int y = screen.height; /* 取得显示器窗口的高度*/setSize(600, 600);int xcenter = (x - 600) / 2;int ycenter = (y - 600) / 2;setLocation(xcenter, ycenter);/* 显示在窗口中央*/setVisible(true);//setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);// 注册临听器Query.addActionListener(this);add.addActionListener(this);delete.addActionListener(this);xiugai.addActionListener(this);liulan.addActionListener(this);}public void actionPerformed(ActionEvent e){String cmd = e.getActionCommand();if (cmd.equals("查询信息")){new QueryWays();}if (cmd.equals("添加信息")){new Add();}if (cmd.equals("删除信息")){new Delete();}if (cmd.equals("浏览全部信息")){new Liulan();}if (cmd.equals("修改密码")){new UpdateCode();}}public static void main(String[] args){new Mstudent("");}}package MS;import java.awt.Color;import java.awt.Container;import java.awt.Dimension;import java.awt.GridLayout;import java.awt.Toolkit;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.sql.Connection;import java.sql.DriverManager;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;import javax.swing.JButton;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JPanel;import javax.swing.JTextField;import javax.swing.SwingConstants;public class Query implements ActionListener {String sql =null;int a;String info;JFrame f3;// Container cp;JPanel jp1,jp2,jp3,jp4,jp,jpwest;JButton btn1,btn2;//确定,取消JLabel label,label2;//标签,请输入姓名(label)JTextField tf,tf1,tf2,tf3,tf4,tf5,tf6;//文本框Query(int a){this.a=a;f3=new JFrame();Container cp=f3.getContentPane();//初始化面板,按钮,标签,文本框jp=new JPanel();jp1=new JPanel();jp2=new JPanel(new GridLayout(6,1));jp3=new JPanel();jp4=new JPanel(new GridLayout(6,1));jpwest=new JPanel();btn1=new JButton("确定");btn2=new JButton("取消");label=new JLabel("<html><font color=#CC00FF size='4'>请输入姓名:" + "</font>",SwingConstants.CENTER);label2=new JLabel("<html><font color=#CC00FF size='4'>请输入学号:" + "</font>",SwingConstants.CENTER);label.setForeground(Color.gray);tf=new JTextField(20);//------------------------------------------------tf1=new JTextField(20);tf2=new JTextField(20);tf3=new JTextField(20);tf4=new JTextField(20);tf5=new JTextField(20);tf6=new JTextField(20);//布局,添加控件if(a==0){jp.add(label);jp.add(tf);}else if(a==1){jp.add(label2);jp.add(tf);}cp.add(jp,"North");jp4.add(new JLabel("姓名",SwingConstants.CENTER));jp2.add(tf1);jp4.add(new JLabel("性别",SwingConstants.CENTER));jp2.add(tf2);jp4.add(new JLabel("学号",SwingConstants.CENTER));jp2.add(tf3);jp4.add(new JLabel("专业",SwingConstants.CENTER));jp2.add(tf4);jp4.add(new JLabel("班级",SwingConstants.CENTER));jp2.add(tf5);jp4.add(new JLabel("入学时间",SwingConstants.CENTER));jp2.add(tf6);jp3.add(btn1);jp3.add(btn2);cp.add(jp4,"West");cp.add(jp2,"East");cp.add(jp3,"South");cp.add(jp1);Toolkit kit=Toolkit.getDefaultToolkit();Dimension screen=kit.getScreenSize();int x=screen.width; //显示窗口宽度int y=screen.height;//窗口高度f3.setSize(350,330);int xcenter=(x-350)/2;int ycenter=(y-330)/2;f3.setLocation(xcenter,ycenter);f3.setVisible(true);//f3.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);btn1.addActionListener(this);btn2.addActionListener(this);/*f3.addWindowListener(new WindowAdapter(){public void windowClosing(WindowEvent e){System.exit(0);}});*/。
Centos6.5下安装Apache_mysql_php源码包安装(LAMP环境搭建图文教程)
Centos6.5下安装Apache_mysql_php源码包安装(LAMP环境搭建图文教程)Centos6.5_Apache_mysql_php(LAMP环境搭建图文教程)安装内容详细介绍:编译安装过程介绍一、解压tar.gz为后缀的压缩软件包二、在Centos系统中源代码包安装过程配置(configure)编译(make)安装(make install)各个软件编译安装顺序搭建LAMP环境时,需要安装的所有软件都要按照一定的顺序安装,我们按Apache->MySQL->PHP顺序安装。
但在安装PHP之前,应先安装PHP5需要的最新版本库文件,例如libxml2、libmcrypt以及GD2库等文件。
安装GD2库是为了让PHP5支持GIF、PNG和JPEG图片格式,所以在安装GD2库之前还要先安装最新的zlib、libpng、freetype 和jpegsrc等库文件。
而且中间还会穿插安装一些软件。
读者可以按照本节提供的顺序安装检查安装时使用的编译工具是否存在Gcc -v如果发现gcc没有安装。
可用下面三种方式进行安装:Gcc安装方法1:yum -y install gccyum -y install gcc-c++yum install makeGcc安装方法2:-- 或者yum groupinstall "Development Tools" 一般用这个就好Gcc安装方法3:-- 或者yum install gcc gcc-c++ kernel-devel卸载默认的低版本环境目前发行的Centos操作系统版本中,如果选择默认全部安装,就已经安装了LAMP环境,但是版本相对都比较低。
我们可以再安装一个LAMP环境和原来的并存,但是这样做没有必要,因为同时只能开启一个LAMP环境。
所要我们要在安装之前,先应检查一下系统中是否已经安装了低版本的环境,如果已经安装过了,停止原来的服务运行,或者把原来的环境卸载掉。
mysqlclient源码编译
mysqlclient源码编译
要编译MySQL客户端源码,您需要遵循以下步骤:
1. 首先,您需要安装MySQL开发依赖项。
这通常包括
`libmysqlclient-dev`软件包,您可以使用以下命令在Ubuntu上安装它:
bash.
sudo apt-get install libmysqlclient-dev.
2. 然后,您需要获取MySQL客户端源代码。
您可以从MySQL官方网站下载最新的MySQL源代码包,或者从MySQL的源代码版本控制系统中获取最新的开发版本。
3. 解压源代码包并进入解压后的目录。
4. 接下来,您需要执行`cmake`命令来生成Makefile。
确保您已经安装了`cmake`工具。
在源代码目录中运行以下命令:
bash.
cmake .
这将生成适用于您的系统的Makefile。
5. 然后,您可以使用`make`命令来编译源代码:
bash.
make.
6. 编译完成后,您可以使用`make install`命令将MySQL客户
端库安装到系统中:
bash.
sudo make install.
完成以上步骤后,您就成功编译了MySQL客户端源码。
请注意,这只是一个简单的示例,实际情况可能会因系统环境、MySQL版本
等因素而有所不同。
在实际操作中,您可能需要根据具体情况进行调整。
mysql 5.5.27 cmake安装
Centos下cmake编译安装mysql5.5.27安装简介用户名:mysql安装目录:/opt/svr/mysql数据库目录:/opt/svr/mysql/data源码包:mysql-5.5.27.tar.gz安装准备# 安装编译工具及依赖库yum -y install gcc gcc-c++ make cmake bison ncurses-devel# 解压tar xvf mysql-5.5.27.tar.gzmv /root/mysql-5.5.27 /opt/src/# 添加用户/usr/sbin/groupadd mysqluseradd -g mysql mysql -s /usr/sbin/nologin# 建立目录mkdir /opt/svr/mysqlmkdir /opt/svr/mysql/data编译安装cmake \-DCMAKE_INSTALL_PREFIX=/opt/svr/mysql \-DMYSQL_UNIX_ADDR=/opt/svr/mysql/mysql.sock \-DDEFAULT_CHARSET=utf8 \-DDEFAULT_COLLATION=utf8_general_ci \-DWITH_MYISAM_STORAGE_ENGINE=1 \-DWITH_INNOBASE_STORAGE_ENGINE=1 \-DWITH_MEMORY_STORAGE_ENGINE=1 \-DWITH_READLINE=1 \-DENABLED_LOCAL_INFILE=1 \-DMYSQL_DATADIR=/opt/svr/mysql/data \-DMYSQL_USER=mysql \-DMYSQL_TCP_PORT=3306make && make install编译参数说明:-DCMAKE_INSTALL_PREFIX=/usr/local/mysql //安装目录-DMYSQL_DATADIR=/usr/local/mysql/data //数据库存放目录-DWITH_MYISAM_STORAGE_ENGINE=1 //安装myisam存储引擎-DWITH_INNOBASE_STORAGE_ENGINE=1 //安装innodb存储引擎-DWITH_ARCHIVE_STORAGE_ENGINE=1 //安装archive存储引擎-DWITH_BLACKHOLE_STORAGE_ENGINE=1 //安装blackhole存储引擎-DENABLED_LOCAL_INFILE=1 //允许从本地导入数据-DDEFAULT_CHARSET=utf8 //使用utf8字符-DDEFAULT_COLLATION=utf8_general_ci //校验字符-DEXTRA_CHARSETS=all //安装所有扩展字符集-DMYSQL_TCP_PORT=3306 //MySQL监听端口-DMYSQL_USER=mysql //MySQL用户名-DWITH-EMBEDDED_SERVER=1 //编译成embedded MySQL library (libmysqld.a)-DSYSCONFDIR=/etc //MySQL配辑文件-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock //Unix socket 文件路径-DWITH_READLINE=1 //快捷键功能-DWITH_SSL=yes//SSL-DWITH_MEMORY_STORAGE_ENGINE=1 //安装memory存储引擎-DWITH_FEDERATED_STORAGE_ENGINE=1 //安装frderated存储引擎-DWITH_PARTITION_STORAGE_ENGINE=1 //安装数据库分区-DINSTALL_PLUGINDIR=/usr/local/mysql/plugin //插件文件及配置路径# 安装mysql默认的数据库chmod +x scripts/mysql_install_dbscripts/mysql_install_db --basedir=/opt/svr/mysql --datadir=/opt/svr/mysql/data--user=mysql# 复制配置文件cp support-files/f /opt/svr/mysql/f# 更改权限chown -R mysql:mysql /opt/svr/mysql修改f配置文件vi /opt/svr/mysql/f加上以下内容[mysqld]basedir = /opt/svr/mysqldatadir = /opt/svr/mysql/datalog-error = /opt/svr/mysql/mysql_error.logpid-file = /opt/svr/mysql/mysql.piduser = mysqltmpdir = /tmp启动mysqlcd /opt/svr/mysql/support-files/cp ./mysql.server /etc/init.d/mysql5service mysql5 start远程访问在CentOS系统中防火墙默认是阻止3306端口的,我们要是想访问mysql数据库,我们需要这个端口,命令如下:# 在iptables 加入运行访问3306/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT# 保存/etc/rc.d/init.d/iptables save# 重新启动iptables/etc/rc.d/init.d/iptables restart# 查看iptables状态/etc/init.d/iptables statusmysql不允许远程用户访问主机服务器 1130安装完之后成使用 mysql admin连接报错:ERROR 1130: Host ***.***.***.*** is not allowed to connect to this MySQL server说明所连接的用户帐号没有远程连接的权限,只能在本机(localhost)登录。
CentOS 6.0安装MySQL 5.6及配置
CentOS 6.0安装MySQL 5.6及配置从今年3月份开始mysql官网开始发布相关的5.6系列的各个版本,对于mysql5.6系列的版本对一起的版本进行了全局性的细节性加强;个人感觉,以下是在虚拟机中配置的mysql5.6.10源码安装的过程分享记录下:一、必要软件包安装:[root@mysql5~]#yum -y install gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurse s-devel libmcrypt* libtool-ltdl-devel* make cmake二、编译安装:[root@mysql5 ~]# groupadd mysql[root@mysql5 ~]# useradd -r -g mysql mysql[root@mysql5 ~]# lsanaconda-ks.cfg install.log install.log.syslog mysql-5.6.10.tar.gz[root@mysql5 ~]# cd /usr/local/[root@mysql5 local]# lsbin etc games include lib libexec sbin share src[root@mysql5 local]# cp /root/mysql-5.6.10.tar.gz /usr/local/[root@mysql5 local]# lltotal 34468drwxr-xr-x 2 root root 4096 Jan 27 2010 bindrwxr-xr-x 2 root root 4096 Jan 27 2010 etcdrwxr-xr-x 2 root root 4096 Jan 27 2010 gamesdrwxr-xr-x 2 root root 4096 Jan 27 2010 includedrwxr-xr-x 2 root root 4096 Jan 27 2010 libdrwxr-xr-x 2 root root 4096 Jan 27 2010 libexec-rw-r--r-- 1 root root 35174149 Apr 17 00:55 mysql-5.6.10.tar.gzdrwxr-xr-x 2 root root 4096 Jan 27 2010 sbindrwxr-xr-x 4 root root 4096 Apr 17 00:32 sharedrwxr-xr-x 2 root root 4096 Jan 27 2010 src[root@mysql5 local]# tar -zxvf mysql-5.6.10.tar.gz[root@mysql5 local]# cd mysql-5.6.10[root@mysql5 local]# cmake . ###编译报如下错误暂不管[ 63%] Building CXX object sql/CMakeFiles/sql.dir/sql_.o/root/mysql-5.6.13/sql/sql_: In member function ‘void Optimize_table_order::best_access_path(JOIN_TAB*, table_map, uint, bool, double, POSITION*, POSITION*)’:/root/mysql-5.6.13/sql/sql_:431: warning: ‘loose_scan_opt.Loose_scan_opt::best_loose_scan_start_key’may be used uninitialized in this function/root/mysql-5.6.13/sql/sql_:431: warning: ‘loose_scan_opt.Loose_scan_opt::best_max_loose_keypart’may be used uninitialized in this function/root/mysql-5.6.13/sql/sql_:431: warning: ‘loose_scan_opt.Loose_scan_opt::best_loose_scan_records’may be used uninitialized in this function/root/mysql-5.6.13/sql/sql_:431: warning: ‘loose_scan_opt.Loose_scan_opt::best_loose_scan_key’may be used uninitialized in this function/root/mysql-5.6.13/sql/sql_:431: warning: ‘loose_scan_opt.Loose_scan_opt::quick_max_loose_keypart’may be used uninitialized in this function[root@mysql5 local]# make && make install三、配置MySQL[root@mysql5 mysql-5.6.10]# chown -R mysql.mysql /usr/local/mysql[root@mysql5 mysql-5.6.10]#[root@mysql5 mysql-5.6.10]# cd /usr/local/mysql/scripts/[root@mysql5 scripts]# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/dataInstalling MySQL system tables...2013-04-17 01:26:58 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2013-04-17 01:26:58 18715 [Note] InnoDB: The InnoDB memory heap is disabled2013-04-17 01:26:58 18715 [Note] InnoDB: Mutexes and rw_locks use InnoDB's own implementation2013-04-17 01:26:58 18715 [Note] InnoDB: Compressed tables use zlib 1.2.32013-04-17 01:26:58 18715 [Note] InnoDB: CPU does not support crc32 instructions2013-04-17 01:26:58 18715 [Note] InnoDB: Initializing buffer pool, size = 128.0M2013-04-17 01:26:58 18715 [Note] InnoDB: Completed initialization of buffer pool2013-04-17 01:26:58 18715 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!2013-04-17 01:26:59 18715 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB2013-04-17 01:26:59 18715 [Note] InnoDB: Database physically writes the file full: wait...2013-04-17 01:26:59 18715 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB2013-04-17 01:26:59 18715 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB2013-04-17 01:26:59 18715 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 2013-04-17 01:26:59 18715 [Warning] InnoDB: New log files created, LSN=457812013-04-17 01:26:59 18715 [Note] InnoDB: Doublewrite buffer not found: creating new2013-04-17 01:26:59 18715 [Note] InnoDB: Doublewrite buffer created2013-04-17 01:26:59 18715 [Note] InnoDB: 128 rollback segment(s) are active.2013-04-17 01:26:59 18715 [Warning] InnoDB: Creating foreign key constraint system tables. 2013-04-17 01:26:59 18715 [Note] InnoDB: Foreign key constraint system tables created2013-04-17 01:26:59 18715 [Note] InnoDB: Creating tablespace and datafile system tables. 2013-04-17 01:26:59 18715 [Note] InnoDB: Tablespace and datafile system tables created.2013-04-17 01:26:59 18715 [Note] InnoDB: Waiting for purge to start2013-04-17 01:26:59 18715 [Note] InnoDB: 1.2.10 started; log sequence number 02013-04-17 01:26:59 18715 [Note] Binlog end2013-04-17 01:26:59 18715 [Note] InnoDB: FTS optimize thread exiting.2013-04-17 01:26:59 18715 [Note] InnoDB: Starting shutdown...2013-04-17 01:27:00 18715 [Note] InnoDB: Shutdown completed; log sequence number 1625977 OKFilling help tables...2013-04-17 01:27:00 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2013-04-17 01:27:00 18738 [Note] InnoDB: The InnoDB memory heap is disabled2013-04-17 01:27:00 18738 [Note] InnoDB: Mutexes and rw_locks use InnoDB's own implementation2013-04-17 01:27:00 18738 [Note] InnoDB: Compressed tables use zlib 1.2.32013-04-17 01:27:00 18738 [Note] InnoDB: CPU does not support crc32 instructions2013-04-17 01:27:00 18738 [Note] InnoDB: Initializing buffer pool, size = 128.0M2013-04-17 01:27:00 18738 [Note] InnoDB: Completed initialization of buffer pool2013-04-17 01:27:00 18738 [Note] InnoDB: Highest supported file format is Barracuda.2013-04-17 01:27:00 18738 [Note] InnoDB: 128 rollback segment(s) are active.2013-04-17 01:27:00 18738 [Note] InnoDB: Waiting for purge to start2013-04-17 01:27:01 18738 [Note] InnoDB: 1.2.10 started; log sequence number 16259772013-04-17 01:27:01 18738 [Note] Binlog end2013-04-17 01:27:01 18738 [Note] InnoDB: FTS optimize thread exiting.2013-04-17 01:27:01 18738 [Note] InnoDB: Starting shutdown...2013-04-17 01:27:02 18738 [Note] InnoDB: Shutdown completed; log sequence number 1625987 OKTo start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands:/usr/local/mysql/bin/mysqladmin -u root password 'new-password'/usr/local/mysql/bin/mysqladmin -u root -h mysql5.6 password 'new-password'Alternatively you can run:/usr/local/mysql/bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default. This isstrongly recommended for production servers.See the manual for more instructions.You can start the MySQL daemon with:cd . ; /usr/local/mysql/bin/mysqld_safe &You can test the MySQL daemon with mysql-test-run.plcd mysql-test ; perl mysql-test-run.plPlease report any problems with the ./bin/mysqlbug script!The latest information about MySQL is available on the web at Support MySQL by buying support/licenses at New default config file was created as /usr/local/mysql/f and will be used by default by the server when you start it.You may edit this file to change server settingsWARNING: Default config file /etc/f exists on the systemThis file will be read by default by the MySQL serverIf you do not want to use this, either remove it, or use the--defaults-file argument to mysqld_safe when starting the server[root@mysql5 scripts]#[root@mysql5 scripts]# cd /usr/local/mysql/support-files/[root@mysql5 support-files]# cp mysql.server /etc/rc.d/init.d/mysql cp: overwrite `/etc/rc.d/init.d/mysql'? y[root@mysql5 support-files]# cp f /etc/fcp: overwrite `/etc/f'? y[root@mysql5 support-files]#[root@mysql5 support-files]# chkconfig -add mysql-add: unknown option[root@mysql5 support-files]# chkconfig --add mysql[root@mysql5 support-files]# chkconfig mysql on[root@mysql5 support-files]# service mysql startStarting MySQL. [ OK ] [root@mysql5 support-files]#[root@mysql5 data]# mysql -u mysql -p -S /tmp/mysql.sockEnter password:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.6.10 Source distributionType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql>mysql> status;--------------mysql Ver 14.12 Distrib 5.0.77, for RedHat-linux-gnu (i686) using readline 5.1Connection id: 1Current database:Current user: mysql@localhostSSL: Not in useCurrent pager: stdoutUsing outfile: ''Using delimiter: ;Server version: 5.6.10 Source distributionProtocol version: 10Connection: Localhost via UNIX socketServer characterset: latin1Db characterset: latin1Client characterset: latin1Conn. characterset: latin1UNIX socket: /tmp/mysql.sockUptime: 3 min 38 secThreads: 1 Questions: 5 Slow queries: 0 Opens: 67 Flush tables: 1 Open tables: 60 Queries per second avg: 0.022--------------mysql>四、远程登录及常用命令1、mysql服务的启动和停止net stop mysqlnet start mysql2、本地登陆mysql及远程登录语法如下:mysql -u用户名-p用户密码键入命令mysql –uroot -p,回车后提示你输入密码,输入12345,然后回车即可进入到mysql 中了,mysql的提示符是:mysql>注意,如果是连接到另外的机器上,则需要加入一个参数-h机器IP但被远程登录的mysql服务器需增加登录账号,方法如下:mysql>GRANT ALL PRIVILEGES ON*.* TO USER1@’%’ IDENTIFIED BY ’password’mysql>FLUSH PRIVILEGES;3、增加新用户格式:grant 权限on 数据库.* to 用户名@登录主机identified by "密码"如,增加一个用户user1密码为password1,让其可以在本机上登录,并对所有数据库有查询、插入、修改、删除的权限。
CentOS 7源码编译安装最新版php5.6和nginx1.7.9及mysql(搭建lnmp环境) – 飞嗨
CentOS 7源码编译安装最新版php5.6和nginx1.7.9及mysql(搭建lnmp环境) –飞嗨突然,一不留神打开了网站,点了一下download,靠,都已经php5.6 stable了,而我yum安装的php还是5.4版本的,太守旧了!嘿嘿,我是微软云的小白鼠,当年就多注册了个账号,还躺着个云服务器在睡觉呢,于是乎,私心想着搭建一个lnmp的备份服务器…源码编译安装,各种依赖包纠结,所以呢,mariadb(mysql)是yum安装的,php5.6和nginx1.7.9是源码安装的…装着装着,在跑./configure脚本的时候,又忘记启用enable curl等等常用扩展鸟,装完后,又去源码目录编译扩展,动态添加扩展…lnmp一、安装mariadb(mysql)服务yum install mariadb mariadb-server mariadb-devel自从mysql被oracle公司收购后,mysql就有闭源收费的风险,所以,就有了社区版改装的mysql分支mariadb来规避这个风险。
centos7开始,yum源的mysql全部都替换成mariadb的了。
所以,mariadb是mysql的一个分支。
不过貌似听说,google有一部分数据库也都已经迁移到mariadb 了,真是要鄙视一下oracle公司,oracle数据库都这么赚了,还打着mysql的主意…二、源码编译安装php5.61.下载php5.6 wget/distributions/php-5.6.5.tar.gz纠结的是,刚安装好的centos 7连wget都木有,所以yum -y install wget然后再下载,,,2.解压tar -xvzf php-5.6.5.tar.gz 进入cd php-5.6.53.运行./configure脚本,启用需要的扩展模块,并指定php的安装目录 ./configure –enable-fpm –enable-mbstring–with-mysql=mysqlnd –with-mysqli=mysqlnd–with-pdo-mysql=mysqlnd这一步很是关键的,我忘记指定–prefix,它默认也是给我安装在/usr/local/php,不过还是指定一下比较妥当。
CENTOS7环境安装MySQL5.6(rpm_二进制_源代码编译三种方式)
CENTOS7环境安装MySQL软件环境虚拟机:VMware® Workstation-10.0.1 build-1379776-Win Linux:Centos 7 X86_64MySQL Database: MySQL-5.6.24系统环境MySQL软件安装一、使用RPM安装。
安装采用RPM安装包安装。
下载mysql:/downloads/mysql/打开页面之后,在Select Platform:下选择linux Generic下载后的包为名称为:MySQL-5.6.24-1.linux_glibc2.5.x86_64.rpm-bundle.tar(一)卸载原有MySQL或者Mariadb安装程序1、CentOs7版本默认情况下安装了mariadb-libs,必须先卸载才可以继续安装MySql。
a) 查找以前是否安装mariadb-libs# rpm -qa | grep -i mariadb-libsb)卸载已经安装的mariadb-libs# yum remove mariadb-libs-5.5.41-2.el7_0.x86_642、查找以前是否安装MySQL# rpm -qa | grep -i mysql--说明已经有安装了MySQL程序a)停止mysql服务# sudo service mysql stop或者:# ps -A | grep mysql# kill -9 进程号b)删除之前安装的mysql# rpm -ve MySQL-server-5.6.24-1.linux_glibc2.5.x86_64# rpm -ve MySQL-client-5.6.24-1.linux_glibc2.5.x86_64c)查找之前老版本mysql的目录、并且删除老版本mysql的文件和库# find / -name mysql【查找结果如下】# find / -name mysql/var/lib/mysql/usr/lib64/mysql/usr/local/mysql/usr/local/mysql/data/mysql【删除对应的目录】# rm -rf /var/lib/mysql# rm -rf /usr/lib64/mysql# rm -rf /usr/local/mysql【删除配置文档】# rm -rf /etc/fd)再次查找机器是否安装mysql# rpm -qa|grep -i mysql【无结果,说明已经卸载彻底、接下来直接安装mysql即可】(二)下载和解压、安装【创建一个任意名称文件夹,如:rpm】# mkdir rpm# cd rpm【下载安装包的压缩文档】# wget /Downloads/MySQL-5.6/MySQL-5.6.17-1.el6.x8 6_64.rpm-bundle.tar# tar –xvf MySQL-5.6.17-1.el6.x86_64.rpm-bundle.tar【创建mysql用户和数据目录】#groupadd mysql#useradd -r -g mysql mysql#cd /usr/local#sudo mkdir mysql#cd mysql#sudo mkdir mysql#sudo chown -R mysql .#sudo chgrp -R mysql .【安装RPM包】#sudo rpm -ivh MySQL-server-5.6.24-1.linux_glibc2.5.x86_64.rpm如果出现错误:FATAL ERROR: please install the following Perl modules beforeexecuting ./scripts/mysql_install_db:Data::Dumper先用yum list 查找下module:# yum list|grep -i perl-modul*# yum install -y perl-Module-Install.noarch#rpm -ev MySQL-server-5.6.24-1.linux_glibc2.5.x86_64重新执行:#sudo rpm -ivh MySQL-server-5.6.24-1.linux_glibc2.5.x86_64.rpm【初始化MySql配置文件】#cp f /etc/f可以简单修改配置如下。
Centos6.7+MySQL5.7.16源码编译安装
MySQL 源码编译安装(CentOS-6.7+MySQL-5.7)部署环境操作系统:CentOS-6.7-x86_64-bin-DVD1.isoBoost库版本: boost_1_59_0.tar.gzMySQL版本:mysql-5.7.16.tar.gz操作用户:root系统IP:192.168.254.231主机名:cp-mysql-01配置:4 核、4G 内存一、服务器配置:1、配置网络# vi /etc/sysconfig/network-scripts/ifcfg-eth02、设置主机名# vi /etc/sysconfig/networkNETWORKING=yesHOSTNAME=cp-mysql-013、设置IP 与主机名的映射# vi /etc/hosts127.0.0.1 cp-mysql-01192.168.254.231 cp-mysql-014、两台数据库服务器的的selinux都要disable(永久关闭selinux,请修改/etc/selinux/config,将SELINUX 改为disabled)# vi /etc/selinux/configSELINUX=disabled5、重启操作系统# reboot二、源码安装MySQL5.7.16:1、使用下面的命令检查是否安装有MySQL Server:# rpm -qa | grepmysqlmysql-libs-5.1.73-5.el6_6.x86_64如果是CentOS7 以上,请使用以下命令查看:# rpm -qa | grepmariadbmariadb-libs-5.5.41-2.el7_0.x86_64(因为没有MySQL 服务,因此没必要卸载。
mysql-libs 是MySQL 的必要包) (如果有的话可通过下面命令来卸载掉,rpm –e mysql //普通删除模式)2、改防火墙设置,打开3306 端口:# vi /etc/sysconfig/iptables增加如下行:## MySQL-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT 重启防火墙:# serviceiptables restart3、新增mysql用户组:# groupaddmysql4、新增mysql用户,并添加到mysql用户组:# useradd -r -g mysqlmysql5、新建MySQL 执行文件目录(后面会把编译好的mysql程序安装到这个目录):# mkdir -p /usr/local/mysql(-p 参数的作用是:如果最终目录的父目录不存在也会一并创建)6、新建MySQL 数据库数据文件目录:# mkdir -p /home/mysql/data# mkdir -p /home/mysql/logs# mkdir -p /home/mysql/temp(注意:上面的logs 及temp 目录是为了以后将MySQL 的数据文件与执行程序文件分离,如果你打算设置到不同的路径,注意修改对应的执行命令和数据库初始化脚本。
mysql破解版安装教程
mysql破解版安装教程MySQL是一种流行的开源数据库管理系统,用于存储和管理大量的数据。
它广泛应用于各种网站和应用程序中。
正版的MySQL是需要购买的,但是有一些破解版的MySQL也可以使用。
下面是破解版MySQL的安装教程。
第一步:下载破解版MySQL安装包。
在互联网上搜索破解版MySQL的下载链接,在下载之前确保你的计算机已经安装了一个好的杀毒软件,以避免下载到恶意软件。
第二步:解压安装包。
下载完成后,使用一个解压软件将安装包解压到一个合适的文件夹中。
第三步:安装MySQL。
进入解压后的文件夹,找到一个名为“setup”或“install”的可执行文件。
双击该文件以开始MySQL的安装过程。
第四步:接受许可协议。
在安装过程中会出现许可协议的界面,阅读许可协议并接受。
如果你不同意许可协议,那么你无法继续安装MySQL。
第五步:选择安装目录。
在接受许可协议后,安装程序会提示你选择MySQL的安装目录。
选择一个你喜欢的目录,并点击“下一步”按钮。
第六步:选择组件。
在接下来的界面上,你可以选择安装哪些MySQL的组件。
默认情况下,所有组件都被选择,你可以保持默认设置,然后点击“下一步”按钮。
第七步:配置MySQL服务器。
在下一个界面上,你需要配置MySQL服务器。
你需要设置一个root密码,这是MySQL的管理员密码。
确保你记住这个密码,因为他是管理MySQL的重要凭证。
第八步:选择安装类型。
在接下来的界面上,你可以选择MySQL的安装类型。
通常有两种选择:完全安装和自定义安装。
根据你的需要选择一个适合你的安装类型,然后点击“下一步”。
第九步:等待安装完成。
安装过程可能需要一些时间,取决于你的计算机性能和安装组件的数量。
请耐心等待,不要中途关闭安装程序。
第十步:安装完成。
当安装完成后,你会看到一个安装完成的界面。
点击“完成”按钮退出安装程序。
现在,你已经成功地安装了破解版的MySQL。
你可以通过点击开始菜单中的MySQL图标来启动MySQL服务器,并使用你之前设置的root密码进行登录。
Linuxcentos7环境下MySQL安装教程
Linux centos7环境下MySQL安装教程MySQL所使用的SQL 语言是用于访问数据库的最常用标准化语言。
那么你知道Linux centos7环境下MySQL安装教程么?接下来是小编为大家收集的Linux centos7环境下MySQL安装教程,欢迎大家阅读:Linux centos7环境下MySQL安装教程1)、my.ini 保存到/etc/my.ini2)、用户权限,单独用户执行一、查找以前是否安装有mysql,使用下面命令:rpm –qa | grep -i mysql如果显示有如下包则说明已安装mysqlmysql-4.1.12-3.RHEL4.1mysqlclient10-3.23.58-4.RHEL4.1二、下载mysql解压包mysql-5.7.17-linux-glibc2.5-x86_64.tar (去网站上下载)网址:/mysql/MySQL-5.7/也可以在Linux操作系统底下进行下载,输入如下命令wget /mysql/MySQL-5.7/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz创建目录software用于存放我们待会要下载的mysql包,先去到该目录输入命令:cd /software下载完成后,你会在software目录下看到多出一份mysql安装包文件三、建立用户,以及mysql的目录1、groupadd mysql #建立一个mysql的组2、useradd -r -g mysqlmysql #建立mysql用户,并且把用户放到mysql组3、passwd mysql #给mysql用户设置一个密码四、解压mysql安装包1、先把tar.gz包移动到/usr/local 目录下,输入命令mv /software/MySQL/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz/usr/local2、解压tar.gz包先去到/usr/local 目录下,输入命令cd /usr/local解压命令 tarzxvfmysql-5.7.17-linux-glibc2.5-x86_64.tar.gz输入查看目录命令 ll会发现多出目录 mysql-5.7.17-linux-glibc2.5-x86_64注意:没有data 目录,my.ini文件在support-files 目录下3、改一下目录名字为 /usr/local/mysql(这是linux下mysql的默认安装安装目录)把解压出来的文件改下名字,改为mysql输入命令: mv mysql-5.7.17-linux-glibc2.5-x86_64 mysql五、配置相关的启动配置文件首先要去到support-files/文件目录下输入命令: cd support-files/1、复制f 到 /etc/f (mysql启动时自动读取)输入命令 f /etc/f2、解决乱码问题输入命令:vi /etc/f (进入可编辑状态)更改:[mysql]default-character-set=utf8(表示解决客户端乱码问题)[mysqld]default-storage-engine=INNODBcharacter_set_server=utf8(表示解决服务端乱码问题)3、复制mysql.server 到/etc/init.d/ 目录下【目的想实现mysqld -install这样开机自动执行效果】输入命令 cp mysql.server /etc/init.d/mysql (mysql是服务名)注意:/etc/init.d/ 目录,等效于注册表HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services记录有那些服务4、修改/etc/init.d/mysql 参数输入命令 vi /etc/init.d/mysql给与两个目录位置basedir=/usr/local/mysqldatadir=/usr/local/mysql/data5、给目录/usr/local/mysql 更改拥有者输入命令 chown -R mysql:mysql /usr/local/mysql/六、初始化mysql的数据库1、初始化mysqlmysql_install_db (老版本的做法)新版本:初始化输入命令./mysqld --initialize --user=mysql--basedir=/usr/local/mysql --datadir=/usr/local/mysql/data 生成出一个data目录,代表数据库已经初始化成功并且mysql的root用户生成一个临时密码:(记录下临时密码XXX)2、给数据库加密输入命令./mysql_ssl_rsa_setup --datadir=/usr/local/mysql/data3、启动mysql输入命令 ./mysqld_safe --user=mysql & (&符表示提交到后台运行mysql服务)七、进入客户端1、登录输入命令 ./mysql -uroot -p然后再输入你的临时密码2、修改密码输入命令set password=password(‘xxxx')八、window远程访问Linux虚拟机的mysql先来看看数据库结构1、关闭防火墙 (或者给防火墙开放端口),这样window才能连接上输入命令 systemctl stop firewalld.service2、给Windows授权输入命令mysql>grant all privileges on *.* toroot@'%' identified by '123456';mysql>use mysql;mysql>select host,user from user;【多出一条远程登录用户记录】mysql>flush privileges;3、远程链接数据库,或者重启(init 6)。
SUSE Linux下源码编译安装apache2.2.6+php5.1.16+mysql5.0.40
SUSE Linux下源码编译安装apache2.2.6+php5.1.16+mysql5.0.40文档一、编译mysql 5.0.40#cd /usr/local/src# tar zxvf mysql-5.0.40.tar.gz# cd mysql-5.0.46#./configure --prefix=/usr/local/mysql --localstatedir=/var/lib/mysql --with-comment=Source --with-server-suffix=-enterprise-gpl --with-mysqld-user=mysql --without-debug --with-big-tables --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=all --with-pthread --enable-static --enable-thread-safe-client --with-client-ldflags=-all-static --with-mysqld-ldflags=-all-static --enable-assembler --without-innodb --without-ndb-debug --without-isam配置成功会提示:MySQL has a Web site at/which carries details on thelatest release, upcoming features, and other information to make yourwork or play with MySQL more productive. There you can also find information about mailing lists for MySQL discussion.Remember to check the platform specific part of the reference manual for hints about installing MySQL on your platform. Also have a look at thefiles in the Docs directory.Thank you for choosing MySQL!# make编译的时间可能会比较长,毕竟优化的比较厉害。
Linux CentOS6.5下编译安装MySQL 5.6.16
一、编译安装MySQL前的准备工作安装编译源码所需的工具和库[sql]view plaincopy1.yum install gcc gcc-c++ ncurses-devel perl安装cmake,从下载源码并编译安装[sql]view plaincopy1.wget /files/v2.8/cmake-2.8.10.2.tar.gz2.tar -xzvf cmake-2.8.10.2.tar.gz3.cd cmake-2.8.10.24../bootstrap ; make ; make install5.cd ~二、设置MySQL用户和组新增mysql用户组[sql]view plaincopy1.groupadd mysql新增mysql用户[sql]view plaincopyeradd -r -g mysql mysql三、新建MySQL所需要的目录新建mysql安装目录[sql]view plaincopy1.mkdir -p /usr/local/mysql新建mysql数据库数据文件目录[sql]view plaincopy1.mkdir -p /data/mysqldb四、下载MySQL源码包并解压从/downloads/mysql/直接下载源码,解压mysql-5.6.16.tar.gz(/这个网站就是用的5.6.16版本)[sql]view plaincopy1.wget /files/mysql-5.6.16.tar.gz2.tar -zxv -f mysql-5.6.16.tar.gz3.cd mysql-5.6.16设置编译参数[sql]view plaincopy1.cmake \2.-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \3.-DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \4.-DDEFAULT_CHARSET=utf8 \5.-DDEFAULT_COLLATION=utf8_general_ci \6.-DWITH_INNOBASE_STORAGE_ENGINE=1 \7.-DWITH_ARCHIVE_STORAGE_ENGINE=1 \8.-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \9.-DMYSQL_DATADIR=/data/mysqldb \10.-DMYSQL_TCP_PORT=3306 \11.-DENABLE_DOWNLOADS=1注:重新运行配置,需要删除CMakeCache.txt文件[sql]view plaincopy1.rm CMakeCache.txt编译源码[sql]view plaincopy1.make安装[sql]view plaincopy1.make install六、修改mysql目录所有者和组修改mysql安装目录[sql]view plaincopy1.cd /usr/local/mysql2.chown -R mysql:mysql .修改mysql数据库文件目录[sql]view plaincopy1.cd /data/mysqldb2.chown -R mysql:mysql .七、初始化mysql数据库[sql]view plaincopy1.cd /usr/local/mysql2.scripts/mysql_install_db --user=mysql --datadir=/data/mysqldb八、复制mysql服务启动配置文件[sql]view plaincopy1.cp /usr/local/mysql/support-files/f /etc/f注:如果/etc/f文件存在,则覆盖。
RedHat Linux 源码安装MYSQL步骤
作者:书剑飘香1.下载mysql server and client。
Mysql官网地址:/downloads/ 首选进入下载页面然后进入Mysql版本下载页面在Linux下选择源代码的安装方式然后下载Linux下的源代码压缩包第二步:我把mysql软件源码包存放在/home/softDev 下边,源码包编译安装的位置在/usr/local/mysql 下边由于现在的MySQL都使用cmake进行编译安装,所以在安装MySql之前,我们首先要把cmake 装到Linux系统上。
(1)安装cmake下载地址:/在安装cmake之前,系统里必须现有gcc和g++程序(2)解压cmake源代码压缩包,并且编译和安装tar zxvf cmake-2.8.10.2.tar.gzcd cmake-2.8.10.2./configuremakemake install(3)准备工作,创建mysql用户组groupadd mysqluseradd -g mysql mysql创建Mysql数据库的安装目录和存放数据文件的目录mkdir -pv /usr/local/mysql/data(4)解压缩Mysql源码包tar xzf mysql-5.5.27.tar.gzcd mysql-5.5.27cmake 编译Mysql#安装make && make install注意事项:从mysql5.5起,mysql源码安装开始使用cmake了。
下面是介绍configure选项如何映射到cmake的等值参数。
1. 命令语法:重新编译时,需要清除旧的对象文件和缓存信息# make clean# rm -f CMakeCache.txt安装选项参数地址:/uid-20774942-id-1993581.html(5)设置权限chown -R mysql:mysql /usr/local/mysql(6)初始化数据库/usr/local/mysql/scripts/mysql_install_db --user=mysql--basedir=/usr/local/mysql --datadir=/usr/local/mysql/data(7)复制一个mysql的配置文件cp /usr/local/mysql/support-files/f /etc/f(8)后台启动Mysql服务查看是否有MySql的端口netstat -tnlp | grep :3306另外也可以通过脚本的方式启动,如下:#将mysql的启动服务添加到系统服务中cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld #给所有用户都增加可执行的权限chmod a+x /etc/init.d/mysqld#现在可以使用下面的命令启动mysqlservice mysqld start#停止mysql服务service mysqld stop#重启mysql服务service mysqld restart将mysql服务添加到开机启动项,让mysql服务开机启动chkconfig --add mysqldchkconfig --level 35 mysqld on。
mysql安装图解教程(for windows)
mysql安装图解教程(for windows)一、MySQL下载与安装1、下载介绍MySQL 开源的东西官网/MySQL的下载地址:/downloads/ 因为要从这个地址下载不少东东,所以详细分析一下这个网页。
·关于镜像网站,没有大陆的,有香港和台湾的。
选择它,是为了加快下载速度,不过也不是绝对的,看你自己咯,一般我都选第一个的。
·这里提供的图解是4.1的,比较老的了,但是安装过程都是差不多的。
(最主要懂得怎么去官网找适合自己的版本下载)点击这个链接,进入下载页面,可以看到,当前版本是4.1.8。
找到“Windows downloads”,如图,因为我使用的是Windows平台。
这里我选择“Without installer (unzip in C:\)”这个版本,因为我喜欢不需要安装的软件,用的不高兴,随时可以直接删除,当然需要自己配置一下才能使用。
点击“Pick a mirror”,进入一个页面,那里的表格可以不填,直接选择一个链接下载它就可以了。
下载后的文件名是“mysql-4.1.8-win-noinstall.zip”,大小是35.2M。
·关于“Graphical c lients” 图形界面的客户端,选择一个吧,可以进行图形化操作,何乐而不为?只不过以前我一直用“MySQL Control Center”的,现在却不开发了。
选择“MySQL Administrator”吧,下载后的文件名是“mysql-administrator-1.0.19-win-noinstall.zip”(这里我选择的是不需要安装版本),大小是4.5M。
同样也选择“MySQL Query Browser”,它是来查询的。
下载后的文件名是“mysql-query-browser-1.1.5-wi n-noin stall.zip”(不需要安装版本),大小是4.5M。
关于这方面的软件比较多,如:MySQL-Front,EMS MySQL Manager等,比较好用,不过它们是要Mone y的。
各平台MySQL启动停止命令
linux平台及windows平台mysql重启方法Linux下重启MySQL的正确方法:1、通过rpm包安装的MySQLservice mysqld restart2、从源码包安装的MySQL// linux关闭MySQL的命令$mysql_dir/bin/mysqladmin -uroot -p shutdown// linux启动MySQL的命令$mysql_dir/bin/mysqld_safe &其中mysql_dir为MySQL的安装目录,mysqladmin和mysqld_safe位于MySQL安装目录的bin目录下,很容易找到的。
3、以上方法都无效的时候,可以通过强行命令:“killall mysql”来关闭MySQL,但是不建议用这样的方式,因为这种野蛮的方法会强行终止MySQL数据库服务,有可能导致表损坏步骤或方法:RedHat Linux (Fedora Core/Cent OS)1.启动:/etc/init.d/mysqld start2.停止:/etc/init.d/mysqld stop3.重启:/etc/init.d/mysqld restartDebian / Ubuntu Linux1.启动:/etc/init.d/mysql start2.停止:/etc/init.d/mysql stop3.重启:/etc/init.d/mysql restartWindows1.点击“开始”->“运行”(快捷键Win+R)。
2.启动:输入net stop mysql3.停止:输入net start mysql提示* Redhat Linux 也支持service command,启动:# service mysqld start 停止:# service mysqld stop 重启:# service mysqld restart* Windows下不能直接重启(restart),只能先停止,再启动。
linuxcentos7安装mysql8的教程
linuxcentos7安装mysql8的教程⼀、RPM版安装查看是否有其他版本的数据库,若有,删除⼲净⾮root⽤户必须要有sudo权限1.下载mysql相关安装包2.其他依赖(可以先跳过该步,看后⾯安装mysql时缺少什么依赖就安装什么依赖)到该⽹址下去寻找gcc、gcc-c++、openssl、perl及其依赖包3.安装mysql(未报错则表⽰安装成功)4.⾃定义配置mysql(如果不想改变mysql的默认相关⽬录,跳⾄第6步)修改Mysql默认的配置⽂件内容sudo vi /etc/f删除所有内容,加⼊以下内容:[mysqld]user=mysqlport=3306datadir=/app/mysql/datasocket=/app/mysql/mysql.socklog-error=/app/mysql/log/mysqld.logpid-file=/app/mysql/mysqld.pid[client]socket=/app/mysql/mysql.sock5.创建配置⽂件中的相关⽬录并修改权限sudo mkdir /app/mysql/data /app/mysql/log -psudo chown mysql:mysql /app/mysql -R6.初始化mysql7.启动mysql若启动出错:a.请查看mysql相关⽬录的所属⽤户和所属组是否是mysqlb.请查看selinux是否关闭:执⾏sudo getenforce得到的结果若不是Permissive,执⾏命令:sudo setenforce 0c.查看端⼝是否被占⽤d.若还是⽆法启动:请查看mysql错误⽇志以及sudo systemctl status mysqld或者journalctl -xe8.登录mysql查看Mysql的初始密码(root@localhost:后⾯的就是初始密码)sudo cat /app/mysql/log |grep root@localhost (做过第4步使⽤该命令)sudo cat /var/log/mysqld.log|grep root@localhost (未做过第4步使⽤该命令)登录mysql,复制上⾯的密码mysql -p9.修改mysql密码(初次登录必须修改密码,否则⽆法使⽤mysql命令)alter user 'root'@'localhost' identified by '你的密码';⼆、源码版安装⾮root⽤户必须要有sudo权限1.下载相关源码包2.安装低版本的gcc、gcc-c++(必须要做,否则升级gcc安装m4/gmp/mpfr/mpc时configure会报错:configure: error: no acceptable C compiler found in $PATH)3.安装源码版cmake必须安装openssl和openssl-devel依赖,下载⽹址同上,否则bootstrap会报错:找不到openssl(能连外⽹的可以直接使⽤命令:sudo yum -y install openssl openssl-devel)tar cmake-3.16.1.tgzcd cmake-3.16.1sudo ./bootstrapsudo makesudo make checksudo make install4.升级gcc、gcc-c++a.安装m4tar -xzvf m4-latest.tar.gzcd m4-1.4.17/sudo ./configure --prefix=/usr/local(--prefix指定安装路径)sudo make (编译)sudo make check (检查编译是否有错,注意是否有Error,可以不做)sudo make install (安装)m4 --version (查看m4版本)正确安装后可以看到如下结果b.安装gmpsudo ln -s /usr/local/bin/m4 /usr/bin (把m4做⼀个软连接到此路径下,否则configure时会报错:checking for suitable m4... configure: error: No usable m4 in $PATH or /usr/5bin (see config.log for reasons).)tar -xvf gmp-6.2.0.tar.xzcd gmp-6.2.0sudo ./configure --prefix=/usr/local/gmp-6.2 (⾮管理员必须要sudo,否则会报错:Permission denied)sudo makesudo make checksudo make installc.安装mpfrtar -xzvf mpfr-4.0.2.tar.gzcd mpfr-4.0.2sudo ./configure --prefix=/usr/local/mpfr-4.0 --with-gmp=/usr/local/gmp-6.2 (--with-gmp为gmp的安装⽬录)sudo makesudo make checksudo make installd.安装mpctar -xzvf mpc-1.1.0.tar.gzcd mpc-1.1sudo ./configure --prefix=/usr/local/mpc-1.1 --with-gmp=/usr/local/gmp-6.2 --with-mpfr=/usr/local/mpfr-4.0sudo makesduo make checksudo make installe.加⼊库⽂件(/usr/local/mpfr-4.0/lib/必须加⼊库⽂件,其他两个可以不做,否则安装升级gcc编译时会报错:error while loading shared libraries: libmpfr.so.6: cannot open shared object file: No such file or directory)sudo vi /etc/ld.so.conf/usr/local/mpfr-4.0/lib//usr/local/gmp-6.2/lib/usr/local/mpc-1.1/libsudo ldconfig (使上⾯的操作⽣效)或者做软连接sudo ln -s /usr/local/mpfr-4.0/lib/libmpfr.so.6 /usr/bin或者复制sudo cp /usr/local/mpfr-4.0/lib/libmpfr.so.6 /usr/bin/f.安装其他依赖(系统未安装依赖包时,必须要装,否则升级gcc编译时会报错:mpc.h:没有那个⽂件或⽬录)下载gmp-devel和libmpc-devel及其依赖包(能连外⽹的可以直接使⽤命令:sudo yum -y install gmp-devel libmpc-devel)g.升级gcctar -xzvf gcc-9.2.0.tar.gzcd gcc-9.2.0sudo ./configure --prefix=/usr/local/gcc-9.2 \--enable-bootstrap\--enable-checking=release \--enable-languages=c,c++ \--enable-threads=posix \--disable-checking\--disable-multilib\--enable--long-long\--with-gmp=/usr/local/gmp-6.2\--with-mpfr=/usr/local/mpfr-4.0\--with-mpc=/usr/local/mpc-1.1sudo make (编译时间较长,1个⼩时的样⼦)sudo make checksudo make install务必卸载低版本的gcc、gcc-c++sudo rpm -e gcc-c++sudo rpm -e gccsudo vi /etc/profile export PATH=$PATH:/usr/local/gcc/bin source /etc/profile查看gcc版本号gcc --version5.安装源码版mysql安装ncurses-devel依赖,否则cmake报错:Curses library not found.Please install appropriate package(能连外⽹的可以直接使⽤命令:sudo yum -y install ncurses-devel,不能连上外⽹的下载地址同第2步⼀样) tar -xzvf mysql-8.0.19.tar.gzcd mysql-8.0.19cmake . -DCMAKE_INSTALL_PREFIX=/app/mysql\-DDEFAULT_CHARSET=utf8\-DDEFAULT_COLLATION=utf8_general_ci\-DENABLED_LOCAL_INFILE=ON\-DWITH_SSL=system\-DMYSQL_DATADIR=/app/mysql/data\-DSYSCONFDIR=/app/mysql/config\-DMYSQL_TCP_PORT=3306\-DMYSQL_UNIX_ADDR=/app/mysql/mysql.sock\-DWITH_BOOST=/home/mcbadm/mysql8/\-DFORCE_INSOURCE_BUILD=1-DDEFAULT_CHARSET:设置字符集-DDEFAULT_COLLATION:设置排序规则-DENABLED_LOCAL_INFILE=ON:启⽤本地数据导⼊⽀持-DWITH_SSL=system:启⽤ssl库⽀持-DMYSQL_DATADIR:数据⽂件⽬录,可任意-DSYSCONFDIR:配置⽂件⽬录,可任意-DMYSQL_TCP_PORT:mysql监听的TCP端⼝-DMYSQL_UNIX_ADDR:mysql.sock路径,可任意-DWITH_BOOST:boost源码包所在⽬录-DFORCE_INSOURCE_BUILD:强制建⽴未存在的资源⽬录cmake若报错,请找到原因解决后删除CMakeCache.txt再次cmakesudo rm -rf /usr/lib64/libstdc++.so.6* (删掉所有低版本c++的库⽂件)sudo ln -s /usr/local/gcc-9.2/lib64 /usr/lib64 (把新安装的⾼本版c++库⽂件加⼊到系统库⽂件中)sudo make (需要⼤概1⼩时)sudo make install6.编写配置⽂件,建⽴⽬录并授权sudo mkdir /app/mysql/configsudo cd /app/mysqlsudo vi config/f加⼊以下内容:[mysqld]user=mysqlport=3306datadir=/app/mysql/datasocket=/app/mysql/mysql.sock[mysqld_safe]log-error=/app/mysql/logs/mysql-err.logpid-file=/app/mysql/mysql.pid[client]socket=/app/mysql/mysql.socksudo useradd mysql -s /sbin/nologinsudo mkdir -p /app/mysql/logssudo touch /app/mysql/logs/mysql-err.logsudo chown -R mysql.mysql /app/mysql7.初始化并登陆修改密码初始化sudo /app/mysql/bin/mysqld --initialize-insecure --user=mysql --datadir=/app/mysql/data --basedir=/app/mysql (⽆初始密码的,若想要初始密码,使⽤--initialize)启动sudo /app/mysql/support-files/mysql.server start登陆(若⽆初始密码直接回车即可)sudo /app/mysql/bin/mysql -p修改密码alter user 'root'@'localhost' identified by '密码';总结以上所述是⼩编给⼤家介绍的linux centos7安装mysql8的教程,希望对⼤家有所帮助!。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Mysql 源码安装一、文章说明最近接触到mysql数据库,因此闲来研究一下,今天演示一下用源码安装mysql,如果使用rpm包安装的话个人感觉挺简单的。
环境说明:操作系统:rhel x86Mysql版本:二、安装cmake以后是通过cmake来编译的)在之前的话直接编辑就可以,而在以后需要通过cmake来编译,在附录中介绍一下直接编译。
下载,本人是在度娘搜的。
[root@node4 ~]# tar -zxvf ~]# cd ./configure --prefix=/usr/local/cmake ----在这里可以使用# gmake && make install[root@node4 make[root@node4 make install备注:configure需要执行编译到目录。
三、创建mysql的安装目录及数据库存放目录[root@node4 ~]# mkdir -p /opt/[root@node4 ~]# mkdir -p /opt/data四、创建mysql用户及用户组[root@node4 ~]# groupadd mysql[root@node4 ~]# useradd -r -g mysql mysql五、安装mysql[root@node4 ~]# tar -zxvf ~]# cd 编译出现以下错误,需要ncurses-devel [root@node4 -DCMAKE_INSTALL_PREFIX=/opt/-DMYSQL_DATADIR=/opt/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all-DENABLED_LOCAL_INFILE=1 -- MySQL Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH) CMake Error at cmake/:83 (MESSAGE):Curses library not found. Please install appropriate package,remove and rerun Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel. Call Stack (most recent call first): cmake/:127 (FIND_CURSES) cmake/:217 (MYSQL_USE_BUNDLED_LIBEDIT) :268 (MYSQL_CHECK_READLINE)-- Configuring incomplete, errors occurred! ----查看ncurses是否安装:[root@node4 rpm -qa|grep necurses .----安装ncurses-devel[root@node4]# rpm -ivh .. warning: ..: Header V3 DSA signature: NOKEY, key ID Preparing... ########################################### [100%] 1:ncurses-devel ########################################### [100%] ----删除[root@node4 find /-name /root/ rm /root/ remove regular file `/root/' yes [root@node4 rm /root/ remove regular file `/root/' yes [root@node4 rm /root/ remove regular file `/root/' yes [root@node4 rm /root/ remove regular file `/root/' yes [root@node4 rm /root/ remove regular file `/root/' yes [root@node4 rm /root/ remove regular file `/root/' yes ----再次进行编译:[root@node4 -DCMAKE_INSTALL_PREFIX=/opt/-DMYSQL_DATADIR=/opt/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all-DENABLED_LOCAL_INFILE=1 [root@node4 && make install备注:-DCMAKE_INSTALL_PREFIX=/usr/local/mysql --user=mysql Installing MySQL system tables... OKFilling help tables...OKTo start mysqld at boot time you have to copy support-files/to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /opt/bin/mysqladmin -u root password 'new-password' /opt/bin/mysqladmin -u root -h node4 password 'new-password' Alternatively you can run: /opt/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd /opt/ ; /opt/bin/mysqld_safe & You can test the MySQL daemon with cd /opt/mysql-test ; perlPlease report any problems with the /opt/scripts/mysqlbug script!九、设置环境变量[root@node4 ~]# vi /root/.bash_profile ----在PATH=$PATH:$HOME/bin添加参数为:PATH=$PATH:$HOME/bin:/opt/bin:/opt/lib [root@node4 ~]# source /root/.bash_profile 十、手动启动mysql[root@node4 ]# ./bin/mysqld_safe --user=mysql & 13072808:34:38 mysqld_safe Starting mysqld daemon with databases from /opt/data----这里MYSQL的root用户还没有配置密码,所以空值。
需要输入密码时,直接点回车键即可。
[root@node4 ]# ./bin/mysqladmin -u root -p shutdown Enter password:13072808:34:46 mysqld_safe mysqld from pid file/opt/data/ ended [1]+ Done ./bin/mysqld_safe --user=mysql十一、另一个简单的启动mysql的方法(mysql已经被添加到系统服务中) [root@node4 ]# service mysql start [root@node4 ]# service mysql stop [root@node4 ]# service mysql restart 如果上述命令出现:mysql未识别的服务[root@node4 ]# service mysql start : unrecognized service则可能mysql还没添加到系统服务中,下面用另一个方法添加:[root@node4 ]# cp support-files//etc/mysql [root@node4 ]# service mysql startStarting MySQL... [ OK ] [root@node4 ]# service mysql stopShutting down MySQL. [ OK ]注意:主要是将拷贝到/etc/中,命名为mysql。
然后再用#service mysql start 来启动mysql即可。
十二、修改Mysql的root用户密码以及打开远程连接[root@node4 ~]# /opt/bin/mysql -u root mysqlWelcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is1Server version: Source distributionCopyright (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>desc user;----为root添加远程连接的能力。